#[non_exhaustive]pub struct Usage {
pub expansions: usize,
pub tokens: usize,
}Expand description
The work an Expander has charged against its
Budget: successful expansions and the tokens they wrote, since the
expander was created or
reset_usage was last called.
Returned by Expander::usage. Failed expansions
are never charged. The struct is #[non_exhaustive] so that further
counters can be added in a minor release; read the fields directly.
Added in 1.1.0.
§Examples
use macro_lang::{Expander, Usage};
let expander: Expander<char> = Expander::new();
let usage = expander.usage();
assert_eq!((usage.expansions, usage.tokens), (0, 0));
assert_eq!(usage, Usage::NONE);
assert_eq!(Usage::default(), Usage::NONE);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.expansions: usizeSuccessful expansions, compared against
Budget::max_expansions.
tokens: usizeTokens written by those expansions, counted as for
Budget::max_tokens.
Implementations§
Trait Implementations§
impl Copy for Usage
impl Eq for Usage
impl StructuralPartialEq for Usage
Auto Trait Implementations§
impl Forget for Usage
impl Freeze for Usage
impl Move for Usage
impl RefUnwindSafe for Usage
impl Send for Usage
impl Sync for Usage
impl Unpin for Usage
impl UnsafeUnpin for Usage
impl UnwindSafe for Usage
Blanket Implementations§
Source§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