pub struct CapabilityOverrideLayer { /* private fields */ }Expand description
Layer for overriding an operator’s effective capability.
This layer updates Capability exposed by
OperatorInfo::capability
without changing the service’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
}));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 Layer for CapabilityOverrideLayer
impl Layer for CapabilityOverrideLayer
Source§fn apply_service(&self, inner: Servicer) -> Servicer
fn apply_service(&self, inner: Servicer) -> Servicer
Intercept the operation service stack. Read more
Source§fn apply_context(
&self,
srv: Servicer,
inner: OperationContext,
) -> OperationContext
fn apply_context( &self, srv: Servicer, inner: OperationContext, ) -> OperationContext
Intercept the operation context (HTTP transport and executor). Read more
Auto Trait Implementations§
impl Freeze for CapabilityOverrideLayer
impl !RefUnwindSafe for CapabilityOverrideLayer
impl Send for CapabilityOverrideLayer
impl Sync for CapabilityOverrideLayer
impl Unpin for CapabilityOverrideLayer
impl UnsafeUnpin 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