pub trait UnscopedToken: TokenTrait {
type ConstructionError;
// Required method
fn try_new() -> Result<Self, Self::ConstructionError>;
// Provided method
fn new() -> Self
where Self: UnscopedToken<ConstructionError = Infallible> { ... }
}Expand description
A token that isn’t intrinsically tied to a scope.
Most token types aren’t, but some like [GhostToken] are.
Required Associated Types§
Sourcetype ConstructionError
type ConstructionError
Constructing a token may fail.
Required Methods§
Sourcefn try_new() -> Result<Self, Self::ConstructionError>
fn try_new() -> Result<Self, Self::ConstructionError>
Constructs a new Token.
§Errors
Some token implementations may chose to be constructible only once, or only while holding a given lock.
Provided Methods§
Sourcefn new() -> Selfwhere
Self: UnscopedToken<ConstructionError = Infallible>,
fn new() -> Selfwhere
Self: UnscopedToken<ConstructionError = Infallible>,
Constructs a new Token. This method may be used instead of UnscopedToken::try_new when .
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.