use crate::slices::typst::fmt_typst_sequence;
use crate::strings::typst::ToTypst;
#[cfg(not(feature = "std"))]
use alloc::collections::BTreeSet;
use alloc::vec::Vec;
use core::fmt::{Formatter, Result};
use core::hash::Hash;
#[cfg(not(feature = "std"))]
use hashbrown::HashSet;
#[cfg(feature = "std")]
use std::collections::{BTreeSet, HashSet};
impl<T: ToTypst> ToTypst for BTreeSet<T> {
#[inline]
fn fmt_typst(&self, f: &mut Formatter) -> Result {
fmt_typst_sequence(self.iter(), "{", "}", f)
}
}
impl<T: Eq + Hash + Ord + ToTypst> ToTypst for HashSet<T> {
fn fmt_typst(&self, f: &mut Formatter) -> Result {
let mut xs = self.iter().collect::<Vec<_>>();
xs.sort_unstable();
fmt_typst_sequence(xs.into_iter(), "{", "}", f)
}
}