Skip to main content

impl_cap_provider_for_has

Macro impl_cap_provider_for_has 

Source
macro_rules! impl_cap_provider_for_has {
    ($ty:ty, $perm:ty) => { ... };
}
Expand description

Implement CapProvider<P> for a type that already implements Has<P>.

Since Has<P> is infallible, the implementation always returns Ok and ignores the target string.

§Example

struct MyCtx { cap: Cap<FsRead> }
impl Has<FsRead> for MyCtx { fn cap_ref(&self) -> Cap<FsRead> { self.cap.clone() } }
capsec_core::impl_cap_provider_for_has!(MyCtx, FsRead);