Struct Grant
pub struct Grant {
pub subscribe: Prefixes,
pub publish: Prefixes,
}Expand description
What a session may subscribe to from this node, and publish into it.
See moq_ext_access::Grant.
What a session may subscribe to from a node, and publish into it.
The shape of a moq-auth grant, so a token means the same thing to a node and to a media relay. Each member is a path prefix that covers the path and every path beneath it; the empty prefix covers everything.
Fields§
§subscribe: PrefixesThe paths the peer may subscribe to.
publish: PrefixesThe paths the peer may publish into the node’s route table.
Implementations§
§impl Grant
impl Grant
pub fn everything() -> Grant
pub fn everything() -> Grant
Returns a grant that allows everything in both directions.
pub fn subscribe_only() -> Grant
pub fn subscribe_only() -> Grant
Returns a grant to subscribe to everything and publish nothing.
pub fn publish_under(publish: impl Into<Prefixes>) -> Grant
pub fn publish_under(publish: impl Into<Prefixes>) -> Grant
Returns a grant to subscribe to everything and publish only at publish.
With a prefix that names the peer, such as live/<peer id>, no peer
can publish at another’s paths.
pub fn with_publish_prefix(self, text: &str) -> Result<Grant, InvalidPath>
pub fn with_publish_prefix(self, text: &str) -> Result<Grant, InvalidPath>
Returns this grant with the prefix text added to what the peer may
publish: the path it names and every path beneath it.
§Errors
Fails with [InvalidPath] if text is not a valid prefix: it holds
*, has an empty segment, or has too many segments.
pub fn union(&self, other: &Grant) -> Grant
pub fn union(&self, other: &Grant) -> Grant
Returns a grant that allows what either this grant or other allows.
pub fn allows_subscribe(&self, path: &str) -> bool
pub fn allows_subscribe(&self, path: &str) -> bool
Reports whether the peer may subscribe to path.
pub fn allows_publish(&self, path: &str) -> bool
pub fn allows_publish(&self, path: &str) -> bool
Reports whether the peer may publish path.
Trait Implementations§
impl Eq for Grant
§impl From<Grant> for Authorization
impl From<Grant> for Authorization
§fn from(grant: Grant) -> Authorization
fn from(grant: Grant) -> Authorization
impl StructuralPartialEq for Grant
Auto Trait Implementations§
impl Freeze for Grant
impl RefUnwindSafe for Grant
impl Send for Grant
impl Sync for Grant
impl Unpin for Grant
impl UnsafeUnpin for Grant
impl UnwindSafe for Grant
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.