Struct xpct::matchers::combinators::CombinatorContext
source · pub struct CombinatorContext<T> { /* private fields */ }
Expand description
A type used with CombinatorMatcher
to borrow, clone, or copy the owned value.
Implementations§
source§impl<T> CombinatorContext<T>
impl<T> CombinatorContext<T>
sourcepub fn borrow<Borrowed: ?Sized>(
&mut self
) -> CombinatorAssertion<'_, '_, T, &Borrowed>where
T: Borrow<Borrowed>,
pub fn borrow<Borrowed: ?Sized>( &mut self ) -> CombinatorAssertion<'_, '_, T, &Borrowed>where T: Borrow<Borrowed>,
Borrow the owned value before making assertions on it.
sourcepub fn map<'a, 'b: 'a, In>(
&'b mut self,
func: impl Fn(&'a T) -> In + 'b
) -> CombinatorAssertion<'a, 'b, T, In>
pub fn map<'a, 'b: 'a, In>( &'b mut self, func: impl Fn(&'a T) -> In + 'b ) -> CombinatorAssertion<'a, 'b, T, In>
Map the owned value before making assertions on it.
This is useful if borrowing, cloning, or copying alone aren’t flexible enough. One case
where this may be useful is calling methods like Option::as_deref
.
source§impl<T> CombinatorContext<T>where
T: Copy,
impl<T> CombinatorContext<T>where T: Copy,
sourcepub fn copied(&mut self) -> CombinatorAssertion<'_, '_, T, T>
pub fn copied(&mut self) -> CombinatorAssertion<'_, '_, T, T>
Copy the owned value before making assertions on it.
source§impl<T> CombinatorContext<T>where
T: Clone,
impl<T> CombinatorContext<T>where T: Clone,
sourcepub fn cloned(&mut self) -> CombinatorAssertion<'_, '_, T, T>
pub fn cloned(&mut self) -> CombinatorAssertion<'_, '_, T, T>
Clone the owned value before making assertions on it.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for CombinatorContext<T>where T: RefUnwindSafe,
impl<T> Send for CombinatorContext<T>where T: Send,
impl<T> Sync for CombinatorContext<T>where T: Sync,
impl<T> Unpin for CombinatorContext<T>where T: Unpin,
impl<T> UnwindSafe for CombinatorContext<T>where T: UnwindSafe,
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