use crate::slices::latex::fmt_latex_sequence;
use crate::strings::latex::ToLatex;
#[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: ToLatex> ToLatex for BTreeSet<T> {
#[inline]
fn fmt_latex(&self, f: &mut Formatter) -> Result {
fmt_latex_sequence(self.iter(), "\\left\\{", "\\right\\}", f)
}
}
impl<T: Eq + Hash + Ord + ToLatex> ToLatex for HashSet<T> {
fn fmt_latex(&self, f: &mut Formatter) -> Result {
let mut xs = self.iter().collect::<Vec<_>>();
xs.sort_unstable();
fmt_latex_sequence(xs.into_iter(), "\\left\\{", "\\right\\}", f)
}
}