pub trait UrnScheme:
Copy
+ Clone
+ PartialEq
+ Eq
+ Hash
+ PartialOrd
+ Ord
+ Debug
+ 'static {
const TASK_PREFIX: &'static str;
const TREE_PREFIX: &'static str;
const VALIDATED: () = _;
}Expand description
The URN namespace an application mints its task identities under.
This crate mints no namespace of its own: every crate::TaskId
and crate::TaskTreeId is parameterized by a scheme the
application defines once, so identities from different systems can
never be confused and no third party can mint another
application’s URNs by accident.
Implement it on a unit struct with trivial derives:
use tasktree::UrnScheme;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
struct ExampleUrn;
impl UrnScheme for ExampleUrn {
const TASK_PREFIX: &'static str = "urn:example:task:";
const TREE_PREFIX: &'static str = "urn:example:task-tree:";
}Both prefixes are validated at compile time when the scheme is
first used: non-empty, ASCII graphic, ending in :, and distinct
from each other.
Required Associated Constants§
Sourceconst TASK_PREFIX: &'static str
const TASK_PREFIX: &'static str
The prefix of a task URN, e.g. urn:example:task:.
Sourceconst TREE_PREFIX: &'static str
const TREE_PREFIX: &'static str
The prefix of a task-tree URN, e.g. urn:example:task-tree:.
Provided Associated Constants§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".