pub struct CapabilityOverrideLayer { /* private fields */ }Expand description
Layer for overriding an accessor’s full capability.
This layer updates Capability exposed by
OperatorInfo::full_capability
without changing the accessor’s native capability. It is useful when the
backend implementation supports a capability, but the specific endpoint or
test setup needs to disable or tune it.
§Examples
use opendal_core::layers::CapabilityOverrideLayer;
use opendal_core::services;
use opendal_core::Operator;
use opendal_core::Result;
let op = Operator::new(services::Memory::default())?
.layer(CapabilityOverrideLayer::new(|mut cap| {
cap.write_with_if_match = false;
cap.delete_max_size = Some(700);
cap
}))
.finish();Implementations§
Source§impl CapabilityOverrideLayer
impl CapabilityOverrideLayer
Sourcepub fn new(
apply: impl Fn(Capability) -> Capability + Send + Sync + 'static,
) -> Self
pub fn new( apply: impl Fn(Capability) -> Capability + Send + Sync + 'static, ) -> Self
Create a new CapabilityOverrideLayer.
Sourcepub fn from_overrides(input: &str) -> Result<Self>
pub fn from_overrides(input: &str) -> Result<Self>
Create a new CapabilityOverrideLayer from capability override entries.
The input is a comma-separated list of capability assignments:
read=truesets a boolean capability totrueread=falsesets a boolean capability tofalsedelete_max_size=1000sets a numeric capabilitydelete_max_size=noneunsets an optional capability
Trait Implementations§
Source§impl Clone for CapabilityOverrideLayer
impl Clone for CapabilityOverrideLayer
Source§fn clone(&self) -> CapabilityOverrideLayer
fn clone(&self) -> CapabilityOverrideLayer
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 moreSource§impl Debug for CapabilityOverrideLayer
impl Debug for CapabilityOverrideLayer
Source§impl<A: Access> Layer<A> for CapabilityOverrideLayer
impl<A: Access> Layer<A> for CapabilityOverrideLayer
Source§type LayeredAccess = A
type LayeredAccess = A
The layered accessor that returned by this layer.
Source§fn layer(&self, inner: A) -> Self::LayeredAccess
fn layer(&self, inner: A) -> Self::LayeredAccess
Intercept the operations on the underlying storage.
Auto Trait Implementations§
impl Freeze for CapabilityOverrideLayer
impl !RefUnwindSafe for CapabilityOverrideLayer
impl Send for CapabilityOverrideLayer
impl Sync for CapabilityOverrideLayer
impl Unpin for CapabilityOverrideLayer
impl !UnwindSafe for CapabilityOverrideLayer
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