pub trait AccessPolicy {
// Required methods
fn markers(&self) -> PermissionMarkers;
fn can_read(
&mut self,
data: &mut dyn NamedTypeLinks,
subject: u32,
link: &Link,
) -> bool;
fn can_write(
&mut self,
data: &mut dyn NamedTypeLinks,
subject: u32,
link: &Link,
) -> bool;
fn can_create(
&mut self,
data: &mut dyn NamedTypeLinks,
subject: u32,
) -> bool;
// Provided method
fn can_reference(
&mut self,
_data: &mut dyn NamedTypeLinks,
_subject: u32,
_link: &Link,
) -> bool { ... }
}Expand description
Who may read, write and refer to what.
A subject is a link address; the null link (0) is a guest, which no rule
but one for Anything matches. A link is given as (index, source, target), so a link that is not stored yet, or not any more, can be asked
about too. data is the store the links are in, for their types.
Required Methods§
Sourcefn markers(&self) -> PermissionMarkers
fn markers(&self) -> PermissionMarkers
The markers the rules are made of.
Sourcefn can_read(
&mut self,
data: &mut dyn NamedTypeLinks,
subject: u32,
link: &Link,
) -> bool
fn can_read( &mut self, data: &mut dyn NamedTypeLinks, subject: u32, link: &Link, ) -> bool
Whether subject may read link; writing allows reading.
Sourcefn can_write(
&mut self,
data: &mut dyn NamedTypeLinks,
subject: u32,
link: &Link,
) -> bool
fn can_write( &mut self, data: &mut dyn NamedTypeLinks, subject: u32, link: &Link, ) -> bool
Whether subject may write link, as it is or as it will be.
Sourcefn can_create(&mut self, data: &mut dyn NamedTypeLinks, subject: u32) -> bool
fn can_create(&mut self, data: &mut dyn NamedTypeLinks, subject: u32) -> bool
Whether subject may write anything at all, and so create links.
Provided Methods§
Sourcefn can_reference(
&mut self,
_data: &mut dyn NamedTypeLinks,
_subject: u32,
_link: &Link,
) -> bool
fn can_reference( &mut self, _data: &mut dyn NamedTypeLinks, _subject: u32, _link: &Link, ) -> bool
Whether subject may refer to link although it need not read it. A
missing address is asked about as an untyped link. A policy without
this right allows references to readable links only.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".