pub struct CommunicationPolicy { /* private fields */ }Expand description
Controls which agents are allowed to communicate with each other.
Implementations§
Source§impl CommunicationPolicy
impl CommunicationPolicy
Sourcepub fn new(default_permission: PermissionLevel) -> Self
pub fn new(default_permission: PermissionLevel) -> Self
Create a policy with the given default permission.
Sourcepub fn check_permission(
&self,
source: &AgentId,
target: &AgentId,
) -> &PermissionLevel
pub fn check_permission( &self, source: &AgentId, target: &AgentId, ) -> &PermissionLevel
Look up the permission level for a (source, target) pair.
Sourcepub fn allow(
&mut self,
source: AgentId,
target: AgentId,
level: PermissionLevel,
)
pub fn allow( &mut self, source: AgentId, target: AgentId, level: PermissionLevel, )
Grant a specific permission level for a (source, target) pair.
Trait Implementations§
Source§impl Clone for CommunicationPolicy
impl Clone for CommunicationPolicy
Source§fn clone(&self) -> CommunicationPolicy
fn clone(&self) -> CommunicationPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CommunicationPolicy
impl RefUnwindSafe for CommunicationPolicy
impl Send for CommunicationPolicy
impl Sync for CommunicationPolicy
impl Unpin for CommunicationPolicy
impl UnsafeUnpin for CommunicationPolicy
impl UnwindSafe for CommunicationPolicy
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