Enum switchboard_on_demand::prelude::Result

1.0.0 · source ·
pub enum Result<T, E> {
    Ok(T),
    Err(E),
}
Expand description

Result is a type that represents either success (Ok) or failure (Err).

See the module documentation for details.

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(E)

Contains the error value

Implementations§

source§

impl<T, E> Result<T, E>

1.0.0 (const: 1.48.0) · source

pub const fn is_ok(&self) -> bool

Returns true if the result is Ok.

§Examples
let x: Result<i32, &str> = Ok(-3);
assert_eq!(x.is_ok(), true);

let x: Result<i32, &str> = Err("Some error message");
assert_eq!(x.is_ok(), false);
1.70.0 · source

pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool

Returns true if the result is Ok and the value inside of it matches a predicate.

§Examples
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);
1.0.0 (const: 1.48.0) · source

pub const fn is_err(&self) -> bool

Returns true if the result is Err.

§Examples
let x: Result<i32, &str> = Ok(-3);
assert_eq!(x.is_err(), false);

let x: Result<i32, &str> = Err("Some error message");
assert_eq!(x.is_err(), true);
1.70.0 · source

pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool

Returns true if the result is Err and the value inside of it matches a predicate.

§Examples
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 · source

pub fn ok(self) -> Option<T>

Converts from Result<T, E> to Option<T>.

Converts self into an Option<T>, consuming self, and discarding the error, if any.

§Examples
let x: Result<u32, &str> = Ok(2);
assert_eq!(x.ok(), Some(2));

let x: Result<u32, &str> = Err("Nothing here");
assert_eq!(x.ok(), None);
1.0.0 · source

pub fn err(self) -> Option<E>

Converts from Result<T, E> to Option<E>.

Converts self into an Option<E>, consuming self, and discarding the success value, if any.

§Examples
let x: Result<u32, &str> = Ok(2);
assert_eq!(x.err(), None);

let x: Result<u32, &str> = Err("Nothing here");
assert_eq!(x.err(), Some("Nothing here"));
1.0.0 (const: 1.48.0) · source

pub const 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
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 (const: unstable) · source

pub fn as_mut(&mut self) -> Result<&mut T, &mut E>

Converts from &mut Result<T, E> to Result<&mut T, &mut E>.

§Examples
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.0.0 · source

pub fn map<U, F>(self, op: F) -> Result<U, E>
where F: FnOnce(T) -> U,

Maps a Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving an Err value untouched.

This function can be used to compose the results of two functions.

§Examples

Print the numbers on each line of a string multiplied by two.

let line = "1\n2\n3\n4\n";

for num in line.lines() {
    match num.parse::<i32>().map(|i| i * 2) {
        Ok(n) => println!("{n}"),
        Err(..) => {}
    }
}
1.41.0 · source

pub fn map_or<U, F>(self, default: U, f: F) -> U
where F: FnOnce(T) -> U,

Returns the provided default (if Err), or applies a function to the contained value (if Ok).

Arguments passed to map_or are eagerly evaluated; if you are passing the result of a function call, it is recommended to use map_or_else, which is lazily evaluated.

§Examples
let x: Result<_, &str> = Ok("foo");
assert_eq!(x.map_or(42, |v| v.len()), 3);

let x: Result<&str, _> = Err("bar");
assert_eq!(x.map_or(42, |v| v.len()), 42);
1.41.0 · source

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U
where D: FnOnce(E) -> U, F: FnOnce(T) -> U,

Maps a Result<T, E> to U by applying fallback function default to a contained Err value, or function f to a contained Ok value.

This function can be used to unpack a successful result while handling an error.

§Examples
let k = 21;

let x : Result<_, &str> = Ok("foo");
assert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 3);

let x : Result<&str, _> = Err("bar");
assert_eq!(x.map_or_else(|e| k * 2, |v| v.len()), 42);
1.0.0 · source

pub fn map_err<F, O>(self, op: O) -> Result<T, F>
where O: FnOnce(E) -> F,

Maps a Result<T, E> to Result<T, F> by applying a function to a contained Err value, leaving an Ok value untouched.

This function can be used to pass through a successful result while handling an error.

§Examples
fn stringify(x: u32) -> String { format!("error code: {x}") }

let x: Result<u32, u32> = Ok(2);
assert_eq!(x.map_err(stringify), Ok(2));

let x: Result<u32, u32> = Err(13);
assert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
1.76.0 · source

pub fn inspect<F>(self, f: F) -> Result<T, E>
where F: FnOnce(&T),

Calls a function with a reference to the contained value if Ok.

Returns the original result.

§Examples
let x: u8 = "4"
    .parse::<u8>()
    .inspect(|x| println!("original: {x}"))
    .map(|x| x.pow(3))
    .expect("failed to parse number");
1.76.0 · source

pub fn inspect_err<F>(self, f: F) -> Result<T, E>
where F: FnOnce(&E),

Calls a function with a reference to the contained value if Err.

Returns the original result.

§Examples
use std::{fs, io};

fn read() -> io::Result<String> {
    fs::read_to_string("address.txt")
        .inspect_err(|e| eprintln!("failed to read file: {e}"))
}
1.47.0 · source

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 · source

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 · source

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
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 · source

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
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);
1.4.0 · source

pub fn expect(self, msg: &str) -> T
where E: Debug,

Returns the contained Ok value, consuming the self value.

Because this function may panic, its use is generally discouraged. Instead, prefer to use pattern matching and handle the Err case explicitly, or call unwrap_or, unwrap_or_else, or unwrap_or_default.

§Panics

Panics if the value is an Err, with a panic message including the passed message, and the content of the Err.

§Examples
let x: Result<u32, &str> = Err("emergency failure");
x.expect("Testing expect"); // panics with `Testing expect: emergency failure`

We recommend that expect messages are used to describe the reason you expect the Result should be Ok.

let path = std::env::var("IMPORTANT_PATH")
    .expect("env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`");

Hint: If you’re having trouble remembering how to phrase expect error messages remember to focus on the word “should” as in “env variable should be set by blah” or “the given binary should be available and executable by the current user”.

For more detail on expect message styles and the reasoning behind our recommendation please refer to the section on “Common Message Styles” in the std::error module docs.

1.0.0 · source

pub fn unwrap(self) -> T
where E: Debug,

Returns the contained Ok value, consuming the self value.

Because this function may panic, its use is generally discouraged. Instead, prefer to use pattern matching and handle the Err case explicitly, or call unwrap_or, unwrap_or_else, or unwrap_or_default.

§Panics

Panics if the value is an Err, with a panic message provided by the Err’s value.

§Examples

Basic usage:

let x: Result<u32, &str> = Ok(2);
assert_eq!(x.unwrap(), 2);
let x: Result<u32, &str> = Err("emergency failure");
x.unwrap(); // panics with `emergency failure`
1.16.0 · source

pub fn unwrap_or_default(self) -> T
where T: Default,

Returns the contained Ok value or a default

Consumes the self argument then, if Ok, returns the contained value, otherwise if Err, returns the default value for that type.

§Examples

Converts a string to an integer, turning poorly-formed strings into 0 (the default value for integers). parse converts a string to any other type that implements FromStr, returning an Err on error.

let good_year_from_input = "1909";
let bad_year_from_input = "190blarg";
let good_year = good_year_from_input.parse().unwrap_or_default();
let bad_year = bad_year_from_input.parse().unwrap_or_default();

assert_eq!(1909, good_year);
assert_eq!(0, bad_year);
1.17.0 · source

pub fn expect_err(self, msg: &str) -> E
where T: Debug,

Returns the contained Err value, consuming the self value.

§Panics

Panics if the value is an Ok, with a panic message including the passed message, and the content of the Ok.

§Examples
let x: Result<u32, &str> = Ok(10);
x.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
1.0.0 · source

pub fn unwrap_err(self) -> E
where T: Debug,

Returns the contained Err value, consuming the self value.

§Panics

Panics if the value is an Ok, with a custom panic message provided by the Ok’s value.

§Examples
let x: Result<u32, &str> = Ok(2);
x.unwrap_err(); // panics with `2`
let x: Result<u32, &str> = Err("emergency failure");
assert_eq!(x.unwrap_err(), "emergency failure");
source

pub fn into_ok(self) -> T
where E: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Ok value, but never panics.

Unlike unwrap, this method is known to never panic on the result types it is implemented for. Therefore, it can be used instead of unwrap as a maintainability safeguard that will fail to compile if the error type of the Result is later changed to an error that can actually occur.

§Examples

fn only_good_news() -> Result<String, !> {
    Ok("this is fine".into())
}

let s: String = only_good_news().into_ok();
println!("{s}");
source

pub fn into_err(self) -> E
where T: Into<!>,

🔬This is a nightly-only experimental API. (unwrap_infallible)

Returns the contained Err value, but never panics.

Unlike unwrap_err, this method is known to never panic on the result types it is implemented for. Therefore, it can be used instead of unwrap_err as a maintainability safeguard that will fail to compile if the ok type of the Result is later changed to a type that can actually occur.

§Examples

fn only_bad_news() -> Result<!, String> {
    Err("Oops, it failed".into())
}

let error: String = only_bad_news().into_err();
println!("{error}");
1.0.0 · source

pub fn and<U>(self, res: Result<U, E>) -> Result<U, E>

Returns res if the result is Ok, otherwise returns the Err value of self.

Arguments passed to and are eagerly evaluated; if you are passing the result of a function call, it is recommended to use and_then, which is lazily evaluated.

§Examples
let x: Result<u32, &str> = Ok(2);
let y: Result<&str, &str> = Err("late error");
assert_eq!(x.and(y), Err("late error"));

let x: Result<u32, &str> = Err("early error");
let y: Result<&str, &str> = Ok("foo");
assert_eq!(x.and(y), Err("early error"));

let x: Result<u32, &str> = Err("not a 2");
let y: Result<&str, &str> = Err("late error");
assert_eq!(x.and(y), Err("not a 2"));

let x: Result<u32, &str> = Ok(2);
let y: Result<&str, &str> = Ok("different result type");
assert_eq!(x.and(y), Ok("different result type"));
1.0.0 · source

pub fn and_then<U, F>(self, op: F) -> Result<U, E>
where F: FnOnce(T) -> Result<U, E>,

Calls op if the result is Ok, otherwise returns the Err value of self.

This function can be used for control flow based on Result values.

§Examples
fn sq_then_to_string(x: u32) -> Result<String, &'static str> {
    x.checked_mul(x).map(|sq| sq.to_string()).ok_or("overflowed")
}

assert_eq!(Ok(2).and_then(sq_then_to_string), Ok(4.to_string()));
assert_eq!(Ok(1_000_000).and_then(sq_then_to_string), Err("overflowed"));
assert_eq!(Err("not a number").and_then(sq_then_to_string), Err("not a number"));

Often used to chain fallible operations that may return Err.

use std::{io::ErrorKind, path::Path};

// Note: on Windows "/" maps to "C:\"
let root_modified_time = Path::new("/").metadata().and_then(|md| md.modified());
assert!(root_modified_time.is_ok());

let should_fail = Path::new("/bad/path").metadata().and_then(|md| md.modified());
assert!(should_fail.is_err());
assert_eq!(should_fail.unwrap_err().kind(), ErrorKind::NotFound);
1.0.0 · source

pub fn or<F>(self, res: Result<T, F>) -> Result<T, F>

Returns res if the result is Err, otherwise returns the Ok value of self.

Arguments passed to or are eagerly evaluated; if you are passing the result of a function call, it is recommended to use or_else, which is lazily evaluated.

§Examples
let x: Result<u32, &str> = Ok(2);
let y: Result<u32, &str> = Err("late error");
assert_eq!(x.or(y), Ok(2));

let x: Result<u32, &str> = Err("early error");
let y: Result<u32, &str> = Ok(2);
assert_eq!(x.or(y), Ok(2));

let x: Result<u32, &str> = Err("not a 2");
let y: Result<u32, &str> = Err("late error");
assert_eq!(x.or(y), Err("late error"));

let x: Result<u32, &str> = Ok(2);
let y: Result<u32, &str> = Ok(100);
assert_eq!(x.or(y), Ok(2));
1.0.0 · source

pub fn or_else<F, O>(self, op: O) -> Result<T, F>
where O: FnOnce(E) -> Result<T, F>,

Calls op if the result is Err, otherwise returns the Ok value of self.

This function can be used for control flow based on result values.

§Examples
fn sq(x: u32) -> Result<u32, u32> { Ok(x * x) }
fn err(x: u32) -> Result<u32, u32> { Err(x) }

assert_eq!(Ok(2).or_else(sq).or_else(sq), Ok(2));
assert_eq!(Ok(2).or_else(err).or_else(sq), Ok(2));
assert_eq!(Err(3).or_else(sq).or_else(err), Ok(9));
assert_eq!(Err(3).or_else(err).or_else(err), Err(3));
1.0.0 · source

pub fn unwrap_or(self, default: T) -> T

Returns the contained Ok value or a provided default.

Arguments passed to unwrap_or are eagerly evaluated; if you are passing the result of a function call, it is recommended to use unwrap_or_else, which is lazily evaluated.

§Examples
let default = 2;
let x: Result<u32, &str> = Ok(9);
assert_eq!(x.unwrap_or(default), 9);

let x: Result<u32, &str> = Err("error");
assert_eq!(x.unwrap_or(default), default);
1.0.0 · source

pub fn unwrap_or_else<F>(self, op: F) -> T
where F: FnOnce(E) -> T,

Returns the contained Ok value or computes it from a closure.

§Examples
fn count(x: &str) -> usize { x.len() }

assert_eq!(Ok(2).unwrap_or_else(count), 2);
assert_eq!(Err("foo").unwrap_or_else(count), 3);
1.58.0 · source

pub unsafe fn unwrap_unchecked(self) -> T

Returns the contained Ok value, consuming the self value, without checking that the value is not an Err.

§Safety

Calling this method on an Err is undefined behavior.

§Examples
let x: Result<u32, &str> = Ok(2);
assert_eq!(unsafe { x.unwrap_unchecked() }, 2);
let x: Result<u32, &str> = Err("emergency failure");
unsafe { x.unwrap_unchecked(); } // Undefined behavior!
1.58.0 · source

pub unsafe fn unwrap_err_unchecked(self) -> E

Returns the contained Err value, consuming the self value, without checking that the value is not an Ok.

§Safety

Calling this method on an Ok is undefined behavior.

§Examples
let x: Result<u32, &str> = Ok(2);
unsafe { x.unwrap_err_unchecked() }; // Undefined behavior!
let x: Result<u32, &str> = Err("emergency failure");
assert_eq!(unsafe { x.unwrap_err_unchecked() }, "emergency failure");
source§

impl<T, E> Result<&T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>
where T: Copy,

Maps a Result<&T, E> to a Result<T, E> by copying the contents of the Ok part.

§Examples
let val = 12;
let x: Result<&i32, i32> = Ok(&val);
assert_eq!(x, Ok(&12));
let copied = x.copied();
assert_eq!(copied, Ok(12));
1.59.0 · source

pub fn cloned(self) -> Result<T, E>
where T: Clone,

Maps a Result<&T, E> to a Result<T, E> by cloning the contents of the Ok part.

§Examples
let val = 12;
let x: Result<&i32, i32> = Ok(&val);
assert_eq!(x, Ok(&12));
let cloned = x.cloned();
assert_eq!(cloned, Ok(12));
source§

impl<T, E> Result<&mut T, E>

1.59.0 · source

pub fn copied(self) -> Result<T, E>
where T: Copy,

Maps a Result<&mut T, E> to a Result<T, E> by copying the contents of the Ok part.

§Examples
let mut val = 12;
let x: Result<&mut i32, i32> = Ok(&mut val);
assert_eq!(x, Ok(&mut 12));
let copied = x.copied();
assert_eq!(copied, Ok(12));
1.59.0 · source

pub fn cloned(self) -> Result<T, E>
where T: Clone,

Maps a Result<&mut T, E> to a Result<T, E> by cloning the contents of the Ok part.

§Examples
let mut val = 12;
let x: Result<&mut i32, i32> = Ok(&mut val);
assert_eq!(x, Ok(&mut 12));
let cloned = x.cloned();
assert_eq!(cloned, Ok(12));
source§

impl<T, E> Result<Option<T>, E>

1.33.0 (const: unstable) · source

pub fn transpose(self) -> Option<Result<T, E>>

Transposes a Result of an Option into an Option of a Result.

Ok(None) will be mapped to None. Ok(Some(_)) and Err(_) will be mapped to Some(Ok(_)) and Some(Err(_)).

§Examples
#[derive(Debug, Eq, PartialEq)]
struct SomeErr;

let x: Result<Option<i32>, SomeErr> = Ok(Some(5));
let y: Option<Result<i32, SomeErr>> = Some(Ok(5));
assert_eq!(x.transpose(), y);
source§

impl<T, E> Result<Result<T, E>, E>

source

pub fn flatten(self) -> Result<T, E>

🔬This is a nightly-only experimental API. (result_flattening)

Converts from Result<Result<T, E>, E> to Result<T, E>

§Examples
#![feature(result_flattening)]
let x: Result<Result<&'static str, u32>, u32> = Ok(Ok("hello"));
assert_eq!(Ok("hello"), x.flatten());

let x: Result<Result<&'static str, u32>, u32> = Ok(Err(6));
assert_eq!(Err(6), x.flatten());

let x: Result<Result<&'static str, u32>, u32> = Err(6);
assert_eq!(Err(6), x.flatten());

Flattening only removes one level of nesting at a time:

#![feature(result_flattening)]
let x: Result<Result<Result<&'static str, u32>, u32>, u32> = Ok(Ok(Ok("hello")));
assert_eq!(Ok(Ok("hello")), x.flatten());
assert_eq!(Ok("hello"), x.flatten().flatten());

Trait Implementations§

source§

impl Add<Length> for Result<Length, Error>

§

type Output = Result<Length, Error>

The resulting type after applying the + operator.
source§

fn add(self, other: Length) -> Result<Length, Error>

Performs the + operation. Read more
§

impl<T, E> BorshDeserialize for Result<T, E>
where T: BorshDeserialize, E: BorshDeserialize,

§

fn deserialize_reader<R>(reader: &mut R) -> Result<Result<T, E>, Error>
where R: Read,

§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

§

impl<T, E> BorshDeserialize for Result<T, E>
where T: BorshDeserialize, E: BorshDeserialize,

§

fn deserialize_reader<R>(reader: &mut R) -> Result<Result<T, E>, Error>
where R: Read,

§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

§

impl<T, E> BorshDeserialize for Result<T, E>
where T: BorshDeserialize, E: BorshDeserialize,

§

fn deserialize(buf: &mut &[u8]) -> Result<Result<T, E>, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
§

impl<T, E> BorshSchema for Result<T, E>
where T: BorshSchema, E: BorshSchema,

§

fn add_definitions_recursively(definitions: &mut BTreeMap<String, Definition>)

Recursively, using DFS, add type definitions required for this type. Type definition partially explains how to serialize/deserialize a type.
§

fn declaration() -> String

Get the name of the type without brackets.
§

impl<T, E> BorshSchema for Result<T, E>
where T: BorshSchema, E: BorshSchema,

§

fn add_definitions_recursively(definitions: &mut HashMap<String, Definition>)

Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type.
§

fn declaration() -> String

Get the name of the type without brackets.
§

fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition>, )

Helper method to add a single type definition to the map.
§

fn schema_container() -> BorshSchemaContainer

§

impl<T, E> BorshSchema for Result<T, E>
where T: BorshSchema, E: BorshSchema,

§

fn add_definitions_recursively(definitions: &mut HashMap<String, Definition>)

Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type.
§

fn declaration() -> String

Get the name of the type without brackets.
§

fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition>, )

Helper method to add a single type definition to the map.
§

fn schema_container() -> BorshSchemaContainer

§

impl<T, E> BorshSerialize for Result<T, E>
where T: BorshSerialize, E: BorshSerialize,

§

fn serialize<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

§

impl<T, E> BorshSerialize for Result<T, E>
where T: BorshSerialize, E: BorshSerialize,

§

fn serialize<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
§

impl<T, E> BorshSerialize for Result<T, E>
where T: BorshSerialize, E: BorshSerialize,

§

fn serialize<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
1.0.0 · source§

impl<T, E> Clone for Result<T, E>
where T: Clone, E: Clone,

source§

fn clone(&self) -> Result<T, E>

Returns a copy of the value. Read more
source§

fn clone_from(&mut self, source: &Result<T, E>)

Performs copy-assignment from source. Read more
source§

impl<T, E> Context<T, E> for Result<T, E>
where E: StdError + Send + Sync + 'static,

source§

fn context<C>(self, context: C) -> Result<T, Error>
where C: Display + Send + Sync + 'static,

Wrap the error value with additional context.
source§

fn with_context<C, F>(self, context: F) -> Result<T, Error>
where C: Display + Send + Sync + 'static, F: FnOnce() -> C,

Wrap the error value with additional context that is evaluated lazily only once an error does occur.
1.0.0 · source§

impl<T, E> Debug for Result<T, E>
where T: Debug, E: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de, T, E> Deserialize<'de> for Result<T, E>
where T: Deserialize<'de>, E: Deserialize<'de>,

source§

fn deserialize<D>( deserializer: D, ) -> Result<Result<T, E>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'de, T, TAs, E, EAs> DeserializeAs<'de, Result<T, E>> for Result<TAs, EAs>
where TAs: DeserializeAs<'de, T>, EAs: DeserializeAs<'de, E>,

source§

fn deserialize_as<D>( deserializer: D, ) -> Result<Result<T, E>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
§

impl<I, O, E> Finish<I, O, E> for Result<(I, O), Err<E>>

§

fn finish(self) -> Result<(I, O), E>

converts the parser’s result to a type that is more consumable by error management libraries. It keeps the same Ok branch, and merges Err::Error and Err::Failure into the Err side. Read more
source§

impl From<&StreamResult> for Result<MZStatus, MZError>

source§

fn from(res: &StreamResult) -> Result<MZStatus, MZError>

Converts to this type from the input type.
§

impl From<&StreamResult> for Result<MZStatus, MZError>

§

fn from(res: &StreamResult) -> Result<MZStatus, MZError>

Converts to this type from the input type.
§

impl From<Errors> for Result<(), Errors>

§

fn from(e: Errors) -> Result<(), Errors>

Converts to this type from the input type.
§

impl From<Output> for Result<Value, Error>

§

fn from(output: Output) -> Result<Value, Error>

Convert into a result. Will be Ok if it is a Success and Err if Failure.

source§

impl From<Result> for Result<(), Unspecified>

source§

fn from(ret: Result) -> Result<(), Unspecified>

Converts to this type from the input type.
§

impl From<Result> for Result<(), Unspecified>

§

fn from(ret: Result) -> Result<(), Unspecified>

Converts to this type from the input type.
§

impl<T> From<SbError> for Result<T, Box<SbError>>

§

fn from(err: SbError) -> Result<T, Box<SbError>>

Converts to this type from the input type.
§

impl<T, E> From<StableResult<T, E>> for Result<T, E>

§

fn from(result: StableResult<T, E>) -> Result<T, E>

Converts to this type from the input type.
source§

impl From<StreamResult> for Result<MZStatus, MZError>

source§

fn from(res: StreamResult) -> Result<MZStatus, MZError>

Converts to this type from the input type.
§

impl From<StreamResult> for Result<MZStatus, MZError>

§

fn from(res: StreamResult) -> Result<MZStatus, MZError>

Converts to this type from the input type.
1.0.0 · source§

impl<A, E, V> FromIterator<Result<A, E>> for Result<V, E>
where V: FromIterator<A>,

source§

fn from_iter<I>(iter: I) -> Result<V, E>
where I: IntoIterator<Item = Result<A, E>>,

Takes each element in the Iterator: if it is an Err, no further elements are taken, and the Err is returned. Should no Err occur, a container with the values of each Result is returned.

Here is an example which increments every integer in a vector, checking for overflow:

let v = vec![1, 2];
let res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|
    x.checked_add(1).ok_or("Overflow!")
).collect();
assert_eq!(res, Ok(vec![2, 3]));

Here is another example that tries to subtract one from another list of integers, this time checking for underflow:

let v = vec![1, 2, 0];
let res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|
    x.checked_sub(1).ok_or("Underflow!")
).collect();
assert_eq!(res, Err("Underflow!"));

Here is a variation on the previous example, showing that no further elements are taken from iter after the first Err.

let v = vec![3, 2, 1, 10];
let mut shared = 0;
let res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32| {
    shared += x;
    x.checked_sub(2).ok_or("Underflow!")
}).collect();
assert_eq!(res, Err("Underflow!"));
assert_eq!(shared, 6);

Since the third element caused an underflow, no further elements were taken, so the final value of shared is 6 (= 3 + 2 + 1), not 16.

§

impl<C, T, E> FromParallelIterator<Result<T, E>> for Result<C, E>
where C: FromParallelIterator<T>, T: Send, E: Send,

Collect an arbitrary Result-wrapped collection.

If any item is Err, then all previous Ok items collected are discarded, and it returns that error. If there are multiple errors, the one returned is not deterministic.

§

fn from_par_iter<I>(par_iter: I) -> Result<C, E>
where I: IntoParallelIterator<Item = Result<T, E>>,

Creates an instance of the collection from the parallel iterator par_iter. Read more
source§

impl<T, E, F> FromResidual<Result<Infallible, E>> for Result<T, F>
where F: From<E>,

source§

fn from_residual(residual: Result<Infallible, E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
source§

impl<T, E, F> FromResidual<Yeet<E>> for Result<T, F>
where F: From<E>,

source§

fn from_residual(_: Yeet<E>) -> Result<T, F>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from a compatible Residual type. Read more
1.0.0 · source§

impl<T, E> Hash for Result<T, E>
where T: Hash, E: Hash,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
1.4.0 · source§

impl<'a, T, E> IntoIterator for &'a Result<T, E>

§

type Item = &'a T

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Iter<'a, T>

Creates an iterator from a value. Read more
1.4.0 · source§

impl<'a, T, E> IntoIterator for &'a mut Result<T, E>

§

type Item = &'a mut T

The type of the elements being iterated over.
§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> IterMut<'a, T>

Creates an iterator from a value. Read more
1.0.0 · source§

impl<T, E> IntoIterator for Result<T, E>

source§

fn into_iter(self) -> IntoIter<T>

Returns a consuming iterator over the possibly contained value.

The iterator yields one value if the result is Result::Ok, otherwise none.

§Examples
let x: Result<u32, &str> = Ok(5);
let v: Vec<u32> = x.into_iter().collect();
assert_eq!(v, [5]);

let x: Result<u32, &str> = Err("nothing!");
let v: Vec<u32> = x.into_iter().collect();
assert_eq!(v, []);
§

type Item = T

The type of the elements being iterated over.
§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
§

impl<'a, T, E> IntoParallelIterator for &'a Result<T, E>
where T: Sync,

§

type Item = &'a T

The type of item that the parallel iterator will produce.
§

type Iter = Iter<'a, T>

The parallel iterator type that will be created.
§

fn into_par_iter(self) -> <&'a Result<T, E> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more
§

impl<'a, T, E> IntoParallelIterator for &'a mut Result<T, E>
where T: Send,

§

type Item = &'a mut T

The type of item that the parallel iterator will produce.
§

type Iter = IterMut<'a, T>

The parallel iterator type that will be created.
§

fn into_par_iter(self) -> <&'a mut Result<T, E> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more
§

impl<T, E> IntoParallelIterator for Result<T, E>
where T: Send,

§

type Item = T

The type of item that the parallel iterator will produce.
§

type Iter = IntoIter<T>

The parallel iterator type that will be created.
§

fn into_par_iter(self) -> <Result<T, E> as IntoParallelIterator>::Iter

Converts self into a parallel iterator. Read more
§

impl<T, E> NonBlockingResult for Result<T, E>
where E: NonBlockingError,

§

type Result = Result<Option<T>, E>

Type of the converted result: Result<Option<T>, E>
§

fn no_block(self) -> <Result<T, E> as NonBlockingResult>::Result

Perform the non-block conversion.
1.0.0 · source§

impl<T, E> Ord for Result<T, E>
where T: Ord, E: Ord,

source§

fn cmp(&self, other: &Result<T, E>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
1.0.0 · source§

impl<T, E> PartialEq for Result<T, E>
where T: PartialEq, E: PartialEq,

source§

fn eq(&self, other: &Result<T, E>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · source§

impl<T, E> PartialOrd for Result<T, E>
where T: PartialOrd, E: PartialOrd,

source§

fn partial_cmp(&self, other: &Result<T, E>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
1.16.0 · source§

impl<T, U, E> Product<Result<U, E>> for Result<T, E>
where T: Product<U>,

source§

fn product<I>(iter: I) -> Result<T, E>
where I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further elements are taken, and the Err is returned. Should no Err occur, the product of all elements is returned.

§Examples

This multiplies each number in a vector of strings, if a string could not be parsed the operation returns Err:

let nums = vec!["5", "10", "1", "2"];
let total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();
assert_eq!(total, Ok(100));
let nums = vec!["5", "10", "one", "2"];
let total: Result<usize, _> = nums.iter().map(|w| w.parse::<usize>()).product();
assert!(total.is_err());
source§

impl<T, E> Residual<T> for Result<Infallible, E>

§

type TryType = Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2_residual)
The “return” type of this meta-function.
§

impl<E> ResultVoidErrExt<E> for Result<Void, E>

§

fn void_unwrap_err(self) -> E

Get the error out of an always-err Result.

Never panics, since it is statically known to be Err.

§

impl<T> ResultVoidExt<T> for Result<T, Void>

§

fn void_unwrap(self) -> T

Get the value out of an always-ok Result.

Never panics, since it is statically known to be Ok.

source§

impl<T, E> ReturnWasmAbi for Result<T, E>
where T: IntoWasmAbi, E: Into<JsValue>, <T as IntoWasmAbi>::Abi: WasmAbi<Prim3 = (), Prim4 = ()>,

§

type Abi = Result<<T as IntoWasmAbi>::Abi, u32>

Same as IntoWasmAbi::Abi
source§

fn return_abi(self) -> <Result<T, E> as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
source§

impl<T, E> Serialize for Result<T, E>
where T: Serialize, E: Serialize,

source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T, TAs, E, EAs> SerializeAs<Result<T, E>> for Result<TAs, EAs>
where TAs: SerializeAs<T>, EAs: SerializeAs<E>,

source§

fn serialize_as<S>( source: &Result<T, E>, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer.
source§

impl Sub<Length> for Result<Length, Error>

§

type Output = Result<Length, Error>

The resulting type after applying the - operator.
source§

fn sub(self, other: Length) -> Result<Length, Error>

Performs the - operation. Read more
1.16.0 · source§

impl<T, U, E> Sum<Result<U, E>> for Result<T, E>
where T: Sum<U>,

source§

fn sum<I>(iter: I) -> Result<T, E>
where I: Iterator<Item = Result<U, E>>,

Takes each element in the Iterator: if it is an Err, no further elements are taken, and the Err is returned. Should no Err occur, the sum of all elements is returned.

§Examples

This sums up every integer in a vector, rejecting the sum if a negative element is encountered:

let f = |&x: &i32| if x < 0 { Err("Negative element found") } else { Ok(x) };
let v = vec![1, 2];
let res: Result<i32, _> = v.iter().map(f).sum();
assert_eq!(res, Ok(3));
let v = vec![1, -2];
let res: Result<i32, _> = v.iter().map(f).sum();
assert_eq!(res, Err("Negative element found"));
1.61.0 · source§

impl<T, E> Termination for Result<T, E>
where T: Termination, E: Debug,

source§

fn report(self) -> ExitCode

Is called to get the representation of the value as status code. This status code is returned to the operating system.
source§

impl<T, E> Try for Result<T, E>

§

type Output = T

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
§

type Residual = Result<Infallible, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
The type of the value passed to FromResidual::from_residual as part of ? when short-circuiting. Read more
source§

fn from_output(output: <Result<T, E> as Try>::Output) -> Result<T, E>

🔬This is a nightly-only experimental API. (try_trait_v2)
Constructs the type from its Output type. Read more
source§

fn branch( self, ) -> ControlFlow<<Result<T, E> as Try>::Residual, <Result<T, E> as Try>::Output>

🔬This is a nightly-only experimental API. (try_trait_v2)
Used in ? to decide whether the operator should produce a value (because this returned ControlFlow::Continue) or propagate a value back to the caller (because this returned ControlFlow::Break). Read more
§

impl<T, E> UncheckedResultExt<T, E> for Result<T, E>

§

unsafe fn unchecked_unwrap_ok(self) -> T

Get the value out of this Result without checking for Err.
§

unsafe fn unchecked_unwrap_err(self) -> E

Get the error out of this Result without checking for Ok.
source§

impl<T, E> UnwrapThrowExt<T> for Result<T, E>
where E: Debug,

source§

fn expect_throw(self, message: &str) -> T

Unwrap this container’s T value, or throw an error to JS with the given message if the T value is unavailable (e.g. an Option<T> is None).
source§

fn unwrap_throw(self) -> T

Unwrap this Option or Result, but instead of panicking on failure, throw an exception to JavaScript.
source§

impl<T> WasmAbi for Result<T, u32>
where T: WasmAbi<Prim3 = (), Prim4 = ()>,

§

type Prim3 = u32

If this Result is an Err, the error value.

§

type Prim4 = u32

Whether this Result is an Err.

§

type Prim1 = <T as WasmAbi>::Prim1

§

type Prim2 = <T as WasmAbi>::Prim2

source§

fn split(self) -> (<T as WasmAbi>::Prim1, <T as WasmAbi>::Prim2, u32, u32)

Splits this type up into primitives to be sent over the ABI.
source§

fn join( prim1: <T as WasmAbi>::Prim1, prim2: <T as WasmAbi>::Prim2, err: u32, is_err: u32, ) -> Result<T, u32>

Reconstructs this type from primitives received over the ABI.
§

impl<T, E> WrapFuture<T, E> for Result<T, E>
where T: Send + 'static, E: Send + 'static,

§

fn into_future(self) -> Pin<Box<dyn Future<Output = Result<T, E>> + Send>>

Convert itself into a boxed future.
1.0.0 · source§

impl<T, E> Copy for Result<T, E>
where T: Copy, E: Copy,

1.0.0 · source§

impl<T, E> Eq for Result<T, E>
where T: Eq, E: Eq,

§

impl<T, U, E> FromStream<Result<T, E>> for Result<U, E>
where U: FromStream<T>,

1.0.0 · source§

impl<T, E> StructuralPartialEq for Result<T, E>

Auto Trait Implementations§

§

impl<T, E> Freeze for Result<T, E>
where T: Freeze, E: Freeze,

§

impl<T, E> RefUnwindSafe for Result<T, E>

§

impl<T, E> Send for Result<T, E>
where T: Send, E: Send,

§

impl<T, E> Sync for Result<T, E>
where T: Sync, E: Sync,

§

impl<T, E> Unpin for Result<T, E>
where T: Unpin, E: Unpin,

§

impl<T, E> UnwindSafe for Result<T, E>
where T: UnwindSafe, E: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<'data, I> IntoParallelRefIterator<'data> for I
where I: 'data + ?Sized, &'data I: IntoParallelIterator,

§

type Iter = <&'data I as IntoParallelIterator>::Iter

The type of the parallel iterator that will be returned.
§

type Item = <&'data I as IntoParallelIterator>::Item

The type of item that the parallel iterator will produce. This will typically be an &'data T reference type.
§

fn par_iter(&'data self) -> <I as IntoParallelRefIterator<'data>>::Iter

Converts self into a parallel iterator. Read more
§

impl<'data, I> IntoParallelRefMutIterator<'data> for I
where I: 'data + ?Sized, &'data mut I: IntoParallelIterator,

§

type Iter = <&'data mut I as IntoParallelIterator>::Iter

The type of iterator that will be created.
§

type Item = <&'data mut I as IntoParallelIterator>::Item

The type of item that will be produced; this is typically an &'data mut T reference.
§

fn par_iter_mut( &'data mut self, ) -> <I as IntoParallelRefMutIterator<'data>>::Iter

Creates the parallel iterator from self. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,