pub struct Resource {
pub path: Vec<Anchor>,
pub attrs: Attributes,
}Expand description
Resource under decision.
path goes from the most specific step to the broadest, for example
[document:7, doc_type:invoice, project:42, org:9]. The global is implicit at the end. The
position in the path is the specificity used by the combination strategy: lower index, more
specific target.
Fields§
§path: Vec<Anchor>§attrs: AttributesImplementations§
Source§impl Resource
impl Resource
pub fn new(kind: impl Into<String>, id: impl Into<String>) -> Self
Sourcepub fn within(self, kind: impl Into<String>, id: impl Into<String>) -> Self
pub fn within(self, kind: impl Into<String>, id: impl Into<String>) -> Self
Adds a broader step at the end of the path.
pub fn with_attr(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Sourcepub fn primary(&self) -> Option<&Anchor>
pub fn primary(&self) -> Option<&Anchor>
Most specific step, which gives the resource’s kind and id.
pub fn contains(&self, anchor: &Anchor) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Resource
impl<'de> Deserialize<'de> for Resource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Resource
Auto Trait Implementations§
impl Forget for Resource
impl Freeze for Resource
impl Move for Resource
impl RefUnwindSafe for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin for Resource
impl UnsafeUnpin for Resource
impl UnwindSafe for Resource
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