1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
use crate::{FormatTokens, Item, ItemStr, Lang, Tokens}; /// Struct containing a type that is quoted. /// /// This is constructed with the [quoted][super::QuotedExt::quoted] function. #[derive(Clone, Copy)] pub struct Quoted<T> { inner: T, } impl<T> Quoted<T> { pub(super) fn new(inner: T) -> Self { Self { inner } } } impl<T, L> FormatTokens<L> for Quoted<T> where L: Lang, T: Into<ItemStr>, { fn format_tokens(self, tokens: &mut Tokens<L>) { tokens.item(Item::Quoted(self.inner.into())); } }