pub struct Scope {
pub name: String,
pub value: String,
}Expand description
A single scope value of an object.
Scopes are used in a hierarchy in object IDs.
Fields§
§name: StringIdentifies the scope.
Examples are organization or project.
value: StringThe value of the scope.
This can be the identifier of a
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn create<V>(name: &str, value: V) -> Result<Self, InvalidScopeError>where
V: Display,
pub fn create<V>(name: &str, value: V) -> Result<Self, InvalidScopeError>where
V: Display,
Creates and validates a new scope.
The name and value must be non-empty.
§Examples
use objectstore_types::scope::Scope;
let scope = Scope::create("organization", "17").unwrap();
assert_eq!(scope.name(), "organization");
assert_eq!(scope.value(), "17");
// Empty names or values are invalid
let invalid_scope = Scope::create("", "value");
assert!(invalid_scope.is_err());Trait Implementations§
Source§impl FromIterator<Scope> for Scopes
impl FromIterator<Scope> for Scopes
Source§impl Ord for Scope
impl Ord for Scope
Source§impl PartialOrd for Scope
impl PartialOrd for Scope
impl Eq for Scope
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnwindSafe for Scope
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