pub trait Types: NamedTypeLinks {
Show 16 methods
// Required methods
fn root(&self) -> u32;
fn extends(&self) -> Option<u32>;
// Provided methods
fn type_of(&mut self, link: u32) -> Option<u32> { ... }
fn is_type(&mut self, link: u32) -> bool { ... }
fn parents_of(&mut self, type_id: u32) -> Vec<u32> { ... }
fn ancestors_of(&mut self, type_id: u32) -> Vec<u32> { ... }
fn is_extension(&mut self, link: u32) -> bool { ... }
fn is_of(&mut self, link: u32, type_id: u32) -> bool { ... }
fn is_of_link(&mut self, link: &Link, type_id: u32) -> bool { ... }
fn is_a(&mut self, link: u32, type_id: u32) -> bool { ... }
fn is_a_link(&mut self, link: &Link, type_id: u32) -> bool { ... }
fn define(&mut self, parent: u32, more: &[u32]) -> Result<u32> { ... }
fn define_root(&mut self) -> Result<u32> { ... }
fn extend(&mut self, type_id: u32, parent: u32) -> Result<u32> { ... }
fn instance(&mut self, type_id: u32) -> Result<u32> { ... }
fn instance_with_target(&mut self, type_id: u32, target: u32) -> Result<u32> { ... }
}Expand description
The queries and writes of a type hierarchy.
Only root and extends are required;
everything else is a default method that reads and writes through Self,
so a layer that wraps a TypesDecorator – a permission check, say –
implements this trait by forwarding the two markers and sees every write
the hierarchy makes. Any default can be overridden.
Required Methods§
Provided Methods§
Sourcefn type_of(&mut self, link: u32) -> Option<u32>
fn type_of(&mut self, link: u32) -> Option<u32>
The type of a link: its source; None for a missing link.
Sourcefn is_type(&mut self, link: u32) -> bool
fn is_type(&mut self, link: u32) -> bool
Whether link is a type: it exists and points at itself.
Sourcefn parents_of(&mut self, type_id: u32) -> Vec<u32>
fn parents_of(&mut self, type_id: u32) -> Vec<u32>
The direct parents of a type: its source (unless it is a point) and what it extends, in the order the extensions were added.
Sourcefn ancestors_of(&mut self, type_id: u32) -> Vec<u32>
fn ancestors_of(&mut self, type_id: u32) -> Vec<u32>
Every type type_id is, itself first, breadth first, without repeats.
Sourcefn is_extension(&mut self, link: u32) -> bool
fn is_extension(&mut self, link: u32) -> bool
Whether link is a pair that gives a type one more parent.
Sourcefn is_of(&mut self, link: u32, type_id: u32) -> bool
fn is_of(&mut self, link: u32, type_id: u32) -> bool
Whether link is strictly of type_id: starting from its source and
the types the link itself extends, through any depth of sub-types and
parents, cycles included. A type is not of itself; is_a is.
Sourcefn is_of_link(&mut self, link: &Link, type_id: u32) -> bool
fn is_of_link(&mut self, link: &Link, type_id: u32) -> bool
is_of for a link given as (index, source, target),
stored or not.
Sourcefn is_a_link(&mut self, link: &Link, type_id: u32) -> bool
fn is_a_link(&mut self, link: &Link, type_id: u32) -> bool
is_a for a link given as (index, source, target),
stored or not.
Sourcefn define(&mut self, parent: u32, more: &[u32]) -> Result<u32>
fn define(&mut self, parent: u32, more: &[u32]) -> Result<u32>
Defines a type (S: parent S) that also extends every type in more.
Sourcefn define_root(&mut self) -> Result<u32>
fn define_root(&mut self) -> Result<u32>
Defines a direct sub-type of root.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".