Make bat::PrettyPrinter::syntaxes() iterate over new bat::Syntax struct by Enselic · Pull Request #2222 · sharkdp/bat (original) (raw)

We can't keep syntect::parsing::SyntaxReference as part of the public API, because that might prevent us from bumping to syntect 6.0.0 without also bumping bat to v2.0.0.

So introduce a new stripped down struct Syntax and return that instead. Let it be fully owned to make the API simple. It is not going to be in a hot code path anyway.

I have looked at all code of our 27 dependents but I can't find a single instance of this method being used, so this change should be safe for v1.0.0. It is only used in our own example code as far as I can tell.

For reference (mostly to my future self), here is the script I used to download the code of all dependents. Then one can grep around in the code of dependents:

#/usr/bin/env bash

curl -L 'https://crates.io/api/v1/crates/bat/reverse_dependencies' | jq --raw-output '.versions | map(.crate) | flatten[]'

curl -L 'https://crates.io/api/v1/crates/bat/reverse_dependencies?page=2' | jq --raw-output '.versions | map(.crate) | flatten[]'

curl -L 'https://crates.io/api/v1/crates/bat/reverse_dependencies?page=3' | jq --raw-output '.versions | map(.crate) | flatten[]'

bat_dependents=" barberousse borrowing_exerci bropages cargo-expand download_caretaker dsconv dts etrade fix-hidden-lifetime-bug-proc_macros gistit-cli gistit git-delta-lib git-delta gooseberry hgrep longboard mdn next-gen-proc_macros nu_plugin_textview partiql-rs piqel pmis qcow-cli raen riffle trrs with_locals-proc_macros "

for crate in $bat_dependents; do echo "Processing $crate" mkdir -p "$crate" cd "$crate" newest_version=$(curl -L https://crates.io/api/v1/crates/$crate | jq --raw-output .crate.newest_version) echo "$newest_version" curl -L "https://crates.io/api/v1/crates/$crate/$newest_version/download" | tar -zxf - cd ..

sleep 2 # avoid throttling

done

Also see #2221