pub struct Store<'a, IdentGenerator = CountingIdentGenerator>where
IdentGenerator: IdentGenerator,{ /* private fields */ }
Expand description
A store for assertions with some custom IdentGenerator
to generate
unique identifiers to be used within asserts. DefaultStore
is recommended for most
purposes, which uses a CountingIdentGenerator
.
This is the central type of this crate. It provides a target to generate assertions into.
All asserts are stored here before beeing turned into tokens (using quote::ToTokens
).
Usually you want to use the assert_into!
macro to actually add the tokens.
§Example
let store = DefaultStore::new();
let token_to_assert_something_on = todo!();
assert_into!(store | token_to_assert_something_on impl std::default::Default);
let tokens = quote!{ #store };
Implementations§
Source§impl<'a, IdentGenerator> Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator,
impl<'a, IdentGenerator> Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator,
pub fn add_extra_items(&mut self, item: impl ToTokens)
Source§impl<'a, IdentGenerator> Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator,
impl<'a, IdentGenerator> Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator,
Trait Implementations§
Source§impl<'a, IdentGenerator> Default for Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator + Default,
impl<'a, IdentGenerator> Default for Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator + Default,
Source§impl<'a, IdentGenerator> ToTokens for Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator + Clone,
impl<'a, IdentGenerator> ToTokens for Store<'a, IdentGenerator>where
IdentGenerator: IdentGenerator + Clone,
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl<'a, IdentGenerator> Freeze for Store<'a, IdentGenerator>where
IdentGenerator: Freeze,
impl<'a, IdentGenerator = CountingIdentGenerator> !RefUnwindSafe for Store<'a, IdentGenerator>
impl<'a, IdentGenerator = CountingIdentGenerator> !Send for Store<'a, IdentGenerator>
impl<'a, IdentGenerator = CountingIdentGenerator> !Sync for Store<'a, IdentGenerator>
impl<'a, IdentGenerator> Unpin for Store<'a, IdentGenerator>where
IdentGenerator: Unpin,
impl<'a, IdentGenerator = CountingIdentGenerator> !UnwindSafe for Store<'a, IdentGenerator>
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T
behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T
behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T
behind Rc
pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T
behind Arc
pointerSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<'a, T, U> ResolveBounds<'a, T> for Uwhere
T: AssertableWithBounds<'a, U> + 'a,
impl<'a, T, U> ResolveBounds<'a, T> for Uwhere
T: AssertableWithBounds<'a, U> + 'a,
fn resolve_for( self, assertable: impl Into<MaybeBorrowed<'a, T>>, ) -> ResolvedBounds<'a, U, T>
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.