Struct mz_dataflow_types::sources::SourceData
source · [−]pub struct SourceData(pub Result<Row, DataflowError>);
Tuple Fields
0: Result<Row, DataflowError>
Methods from Deref<Target = Result<Row, DataflowError>>
sourcepub fn is_ok_and(&self, f: impl FnOnce(&T) -> bool) -> bool
🔬 This is a nightly-only experimental API. (is_some_with
)
pub fn is_ok_and(&self, f: impl FnOnce(&T) -> bool) -> bool
is_some_with
)Returns true
if the result is Ok
and the value inside of it matches a predicate.
Examples
#![feature(is_some_with)]
let x: Result<u32, &str> = Ok(2);
assert_eq!(x.is_ok_and(|&x| x > 1), true);
let x: Result<u32, &str> = Ok(0);
assert_eq!(x.is_ok_and(|&x| x > 1), false);
let x: Result<u32, &str> = Err("hey");
assert_eq!(x.is_ok_and(|&x| x > 1), false);
sourcepub fn is_err_and(&self, f: impl FnOnce(&E) -> bool) -> bool
🔬 This is a nightly-only experimental API. (is_some_with
)
pub fn is_err_and(&self, f: impl FnOnce(&E) -> bool) -> bool
is_some_with
)Returns true
if the result is Err
and the value inside of it matches a predicate.
Examples
#![feature(is_some_with)]
use std::io::{Error, ErrorKind};
let x: Result<u32, Error> = Err(Error::new(ErrorKind::NotFound, "!"));
assert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), true);
let x: Result<u32, Error> = Err(Error::new(ErrorKind::PermissionDenied, "!"));
assert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
let x: Result<u32, Error> = Ok(123);
assert_eq!(x.is_err_and(|x| x.kind() == ErrorKind::NotFound), false);
1.0.0 · sourcepub fn as_ref(&self) -> Result<&T, &E>
pub fn as_ref(&self) -> Result<&T, &E>
Converts from &Result<T, E>
to Result<&T, &E>
.
Produces a new Result
, containing a reference
into the original, leaving the original in place.
Examples
Basic usage:
let x: Result<u32, &str> = Ok(2);
assert_eq!(x.as_ref(), Ok(&2));
let x: Result<u32, &str> = Err("Error");
assert_eq!(x.as_ref(), Err(&"Error"));
1.0.0 · sourcepub fn as_mut(&mut self) -> Result<&mut T, &mut E>
pub fn as_mut(&mut self) -> Result<&mut T, &mut E>
Converts from &mut Result<T, E>
to Result<&mut T, &mut E>
.
Examples
Basic usage:
fn mutate(r: &mut Result<i32, i32>) {
match r.as_mut() {
Ok(v) => *v = 42,
Err(e) => *e = 0,
}
}
let mut x: Result<i32, i32> = Ok(2);
mutate(&mut x);
assert_eq!(x.unwrap(), 42);
let mut x: Result<i32, i32> = Err(13);
mutate(&mut x);
assert_eq!(x.unwrap_err(), 0);
1.47.0 · sourcepub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E> where
T: Deref,
pub fn as_deref(&self) -> Result<&<T as Deref>::Target, &E> where
T: Deref,
Converts from Result<T, E>
(or &Result<T, E>
) to Result<&<T as Deref>::Target, &E>
.
Coerces the Ok
variant of the original Result
via Deref
and returns the new Result
.
Examples
let x: Result<String, u32> = Ok("hello".to_string());
let y: Result<&str, &u32> = Ok("hello");
assert_eq!(x.as_deref(), y);
let x: Result<String, u32> = Err(42);
let y: Result<&str, &u32> = Err(&42);
assert_eq!(x.as_deref(), y);
1.47.0 · sourcepub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E> where
T: DerefMut,
pub fn as_deref_mut(&mut self) -> Result<&mut <T as Deref>::Target, &mut E> where
T: DerefMut,
Converts from Result<T, E>
(or &mut Result<T, E>
) to Result<&mut <T as DerefMut>::Target, &mut E>
.
Coerces the Ok
variant of the original Result
via DerefMut
and returns the new Result
.
Examples
let mut s = "HELLO".to_string();
let mut x: Result<String, u32> = Ok("hello".to_string());
let y: Result<&mut str, &mut u32> = Ok(&mut s);
assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
let mut i = 42;
let mut x: Result<String, u32> = Err(42);
let y: Result<&mut str, &mut u32> = Err(&mut i);
assert_eq!(x.as_deref_mut().map(|x| { x.make_ascii_uppercase(); x }), y);
1.0.0 · sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator over the possibly contained value.
The iterator yields one value if the result is Result::Ok
, otherwise none.
Examples
Basic usage:
let x: Result<u32, &str> = Ok(7);
assert_eq!(x.iter().next(), Some(&7));
let x: Result<u32, &str> = Err("nothing!");
assert_eq!(x.iter().next(), None);
1.0.0 · sourcepub fn iter_mut(&mut self) -> IterMut<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Returns a mutable iterator over the possibly contained value.
The iterator yields one value if the result is Result::Ok
, otherwise none.
Examples
Basic usage:
let mut x: Result<u32, &str> = Ok(7);
match x.iter_mut().next() {
Some(v) => *v = 40,
None => {},
}
assert_eq!(x, Ok(40));
let mut x: Result<u32, &str> = Err("nothing!");
assert_eq!(x.iter_mut().next(), None);
sourcepub fn contains<U>(&self, x: &U) -> bool where
U: PartialEq<T>,
🔬 This is a nightly-only experimental API. (option_result_contains
)
pub fn contains<U>(&self, x: &U) -> bool where
U: PartialEq<T>,
option_result_contains
)Returns true
if the result is an Ok
value containing the given value.
Examples
#![feature(option_result_contains)]
let x: Result<u32, &str> = Ok(2);
assert_eq!(x.contains(&2), true);
let x: Result<u32, &str> = Ok(3);
assert_eq!(x.contains(&2), false);
let x: Result<u32, &str> = Err("Some error message");
assert_eq!(x.contains(&2), false);
sourcepub fn contains_err<F>(&self, f: &F) -> bool where
F: PartialEq<E>,
🔬 This is a nightly-only experimental API. (result_contains_err
)
pub fn contains_err<F>(&self, f: &F) -> bool where
F: PartialEq<E>,
result_contains_err
)Returns true
if the result is an Err
value containing the given value.
Examples
#![feature(result_contains_err)]
let x: Result<u32, &str> = Ok(2);
assert_eq!(x.contains_err(&"Some error message"), false);
let x: Result<u32, &str> = Err("Some error message");
assert_eq!(x.contains_err(&"Some error message"), true);
let x: Result<u32, &str> = Err("Some other error message");
assert_eq!(x.contains_err(&"Some error message"), false);
Trait Implementations
sourceimpl Clone for SourceData
impl Clone for SourceData
sourcefn clone(&self) -> SourceData
fn clone(&self) -> SourceData
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Codec for SourceData
impl Codec for SourceData
sourceimpl Debug for SourceData
impl Debug for SourceData
sourceimpl Deref for SourceData
impl Deref for SourceData
sourceimpl DerefMut for SourceData
impl DerefMut for SourceData
sourceimpl RustType<ProtoSourceData> for SourceData
impl RustType<ProtoSourceData> for SourceData
sourcefn into_proto(&self) -> ProtoSourceData
fn into_proto(&self) -> ProtoSourceData
Convert a Self
into a Proto
value.
sourcefn from_proto(proto: ProtoSourceData) -> Result<Self, TryFromProtoError>
fn from_proto(proto: ProtoSourceData) -> Result<Self, TryFromProtoError>
Consume and convert a Proto
back into a Self
value. Read more
Auto Trait Implementations
impl RefUnwindSafe for SourceData
impl Send for SourceData
impl Sync for SourceData
impl Unpin for SourceData
impl UnwindSafe for SourceData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
impl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more