pub struct TokenRegistry { /* private fields */ }Expand description
Hands out host box tokens that were never minted or reserved before, from 1 up to MAX_HOST_TOKEN.
Implementations§
Source§impl TokenRegistry
impl TokenRegistry
Sourcepub fn mint(&mut self) -> Result<u32, TokenError>
pub fn mint(&mut self) -> Result<u32, TokenError>
A fresh token.
Sourcepub fn reserve(&mut self, token: u32) -> Result<(), TokenError>
pub fn reserve(&mut self, token: u32) -> Result<(), TokenError>
Mark a token the host chose itself as taken so it is never minted.
Sourcepub fn reserve_document(&mut self, doc: &Document)
pub fn reserve_document(&mut self, doc: &Document)
Reserve every token in a document, tokens above the limit are left to Document::validate.
Trait Implementations§
Source§impl Clone for TokenRegistry
impl Clone for TokenRegistry
Source§impl Debug for TokenRegistry
impl Debug for TokenRegistry
Auto Trait Implementations§
impl Freeze for TokenRegistry
impl RefUnwindSafe for TokenRegistry
impl Send for TokenRegistry
impl Sync for TokenRegistry
impl Unpin for TokenRegistry
impl UnsafeUnpin for TokenRegistry
impl UnwindSafe for TokenRegistry
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