Enum Result

1.6.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.6.0

Ok(T)

Contains the success value

ยง1.6.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 (const: unstable) ยท Source

pub fn is_ok_and<F>(self, f: F) -> bool
where F: FnOnce(T) -> 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);

let x: Result<String, &str> = Ok("ownership".to_string());
assert_eq!(x.as_ref().is_ok_and(|x| x.len() > 1), true);
println!("still alive {:?}", x);
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 (const: unstable) ยท Source

pub fn is_err_and<F>(self, f: F) -> bool
where F: FnOnce(E) -> 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);

let x: Result<u32, String> = Err("ownership".to_string());
assert_eq!(x.as_ref().is_err_and(|x| x.len() > 1), true);
println!("still alive {:?}", x);
1.0.0 (const: unstable) ยท 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 (const: unstable) ยท 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: 1.83.0) ยท Source

pub const 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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);
Source

pub const fn map_or_default<U, F>(self, f: F) -> U
where F: FnOnce(T) -> U, U: Default,

๐Ÿ”ฌThis is a nightly-only experimental API. (result_option_map_or_default)

Maps a Result<T, E> to a U by applying function f to the contained value if the result is Ok, otherwise if Err, returns the default value for the type U.

ยงExamples
#![feature(result_option_map_or_default)]

let x: Result<_, &str> = Ok("foo");
let y: Result<&str, _> = Err("bar");

assert_eq!(x.map_or_default(|x| x.len()), 3);
assert_eq!(y.map_or_default(|y| y.len()), 0);
1.0.0 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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. Panics are meant for unrecoverable errors, and may abort the entire program.

Instead, prefer to use the ? (try) operator, or pattern matching to 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 (const: unstable) ยท 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 const 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 const 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: unstable) ยท 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 (const: 1.83.0) ยท Source

pub const 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 (const: 1.83.0) ยท Source

pub const 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: 1.83.0) ยท Source

pub const 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>

1.89.0 (const: 1.89.0) ยท Source

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

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

ยงExamples
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:

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ยง

ยง

impl<T, E> AddAnyAttr for Result<T, E>
where T: AddAnyAttr, E: Into<Error> + Send + 'static,

ยง

type Output<SomeNewAttr: Attribute> = Result<<T as AddAnyAttr>::Output<SomeNewAttr>, E>

The new type once the attribute has been added.
ยง

fn add_any_attr<NewAttr>( self, attr: NewAttr, ) -> <Result<T, E> as AddAnyAttr>::Output<NewAttr>
where NewAttr: Attribute, <Result<T, E> as AddAnyAttr>::Output<NewAttr>: RenderHtml,

Adds an attribute to the view.
ยง

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

ยง

type Archived = ArchivedResult<<T as Archive>::Archived, <E as Archive>::Archived>

The archived representation of this type. Read more
ยง

type Resolver = Result<<T as Archive>::Resolver, <E as Archive>::Resolver>

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
ยง

unsafe fn resolve( &self, pos: usize, resolver: <Result<T, E> as Archive>::Resolver, out: *mut <Result<T, E> as Archive>::Archived, )

Creates the archived version of this value at the given position and writes it to the given output. Read more
Sourceยง

impl<'de, T, U, Context> BorrowDecode<'de, Context> for Result<T, U>
where T: BorrowDecode<'de, Context>, U: BorrowDecode<'de, Context>,

Sourceยง

fn borrow_decode<D>(decoder: &mut D) -> Result<Result<T, U>, DecodeError>
where D: BorrowDecoder<'de, Context = Context>,

Attempt to decode this type with the given BorrowDecode.
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 duplicate 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<Context, T, U> Decode<Context> for Result<T, U>
where T: Decode<Context>, U: Decode<Context>,

Sourceยง

fn decode<D>(decoder: &mut D) -> Result<Result<T, U>, DecodeError>
where D: Decoder<Context = Context>,

Attempt to decode this type with the given Decode.
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
ยง

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

ยง

type Left = T

ยง

type Right = E

ยง

fn either_or<FA, A, FB, B>(self, a: FA, b: FB) -> Either<A, B> โ“˜
where FA: FnOnce(<Result<T, E> as EitherOr>::Left) -> A, FB: FnOnce(<Result<T, E> as EitherOr>::Right) -> B,

Sourceยง

impl<T, U> Encode for Result<T, U>
where T: Encode, U: Encode,

Sourceยง

fn encode<E>(&self, encoder: &mut E) -> Result<(), EncodeError>
where E: Encoder,

Encode a given type.
ยง

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
ยง

impl From<&Result<String, VarError>> for Env

ยง

fn from(input: &Result<String, VarError>) -> Env

Converts to this type from the input type.
ยง

impl From<&Result<String, VarError>> for ReloadWSProtocol

ยง

fn from(input: &Result<String, VarError>) -> ReloadWSProtocol

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.
Sourceยง

impl<L, R> From<Either<L, R>> for Result<R, L>

Convert from Either to Result with Right => Ok and Left => Err.

Sourceยง

fn from(val: Either<L, R>) -> Result<R, L>

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<A, B> From<Result<A, B>> for Either<A, B>

ยง

fn from(value: Result<A, B>) -> Either<A, B> โ“˜

Converts to this type from the input type.
Sourceยง

impl<L, R> From<Result<R, L>> for Either<L, R>

Convert from Result to Either with Ok => Right and Err => Left.

Sourceยง

fn from(r: Result<R, L>) -> Either<L, R> โ“˜

Converts to this type from the input type.
ยง

impl<T> From<Result<T, Error>> for ParsingResult<T>

ยง

fn from(result: Result<T, Error>) -> ParsingResult<T>

Convert into syn::Result, Returns Error on ParsingResult::Failed, and ParsingResult::Partial.

ยง

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

ยง

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

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
ยง

impl<S, T> FromRequest<S> for Result<T, <T as FromRequest<S>>::Rejection>
where T: FromRequest<S>, S: Send + Sync,

ยง

type Rejection = Infallible

If the extractor fails itโ€™ll use this โ€œrejectionโ€ type. A rejection is a kind of error that can be converted into a response.
ยง

async fn from_request( req: Request<Body>, state: &S, ) -> Result<Result<T, <T as FromRequest<S>>::Rejection>, <Result<T, <T as FromRequest<S>>::Rejection> as FromRequest<S>>::Rejection>

Perform the extraction.
ยง

impl<S, T> FromRequestParts<S> for Result<T, <T as FromRequestParts<S>>::Rejection>
where T: FromRequestParts<S>, S: Send + Sync,

ยง

type Rejection = Infallible

If the extractor fails itโ€™ll use this โ€œrejectionโ€ type. A rejection is a kind of error that can be converted into a response.
ยง

async fn from_request_parts( parts: &mut Parts, state: &S, ) -> Result<Result<T, <T as FromRequestParts<S>>::Rejection>, <Result<T, <T as FromRequestParts<S>>::Rejection> as FromRequestParts<S>>::Rejection>

Perform the extraction.
Sourceยง

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

Sourceยง

fn from_residual(x: Result<Infallible, E>) -> Poll<Option<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<Result<Infallible, E>> for Poll<Result<T, F>>
where F: From<E>,

Sourceยง

fn from_residual(x: Result<Infallible, E>) -> Poll<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<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
ยง

impl<T, E> InstrumentResult<T> for Result<T, E>
where E: InstrumentError,

ยง

type Instrumented = <E as InstrumentError>::Instrumented

The type of the wrapped error after instrumentation
ยง

fn in_current_span( self, ) -> Result<T, <Result<T, E> as InstrumentResult<T>>::Instrumented>

Instrument an Error by bundling it with a SpanTrace Read more
1.4.0 ยท Sourceยง

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

Sourceยง

type Item = &'a T

The type of the elements being iterated over.
Sourceยง

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>

Sourceยง

type Item = &'a mut T

The type of the elements being iterated over.
Sourceยง

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, []);
Sourceยง

type Item = T

The type of the elements being iterated over.
Sourceยง

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
ยง

impl<B, E> IntoMapRequestResult<B> for Result<Request<B>, E>
where E: IntoResponse,

ยง

fn into_map_request_result(self) -> Result<Request<B>, Response<Body>>

Perform the conversion.
ยง

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> IntoResponse for Result<T, E>

ยง

fn into_response(self) -> Response<Body>

Create a response.
ยง

impl<T> IntoResponse for Result<T, ErrorResponse>
where T: IntoResponse,

ยง

fn into_response(self) -> Response<Body>

Create a response.
ยง

impl<M, E> Mountable for Result<M, E>
where M: Mountable,

ยง

fn unmount(&mut self)

Detaches the view from the DOM.
ยง

fn mount(&mut self, parent: &Element, marker: Option<&Node>)

Mounts a node to the interface.
ยง

fn insert_before_this(&self, child: &mut dyn Mountable) -> bool

Inserts another Mountable type before this one. Returns false if this does not actually exist in the UI (for example, ()).
ยง

fn elements(&self) -> Vec<Element>

wip
ยง

fn try_mount(&mut self, parent: &Element, marker: Option<&Node>) -> bool

Mounts a node to the interface. Returns false if it could not be mounted.
ยง

fn insert_before_this_or_marker( &self, parent: &Element, child: &mut dyn Mountable, marker: Option<&Node>, )

Inserts another Mountable type before this one, or before the marker if this one doesnโ€™t exist in the UI (for example, ()).
ยง

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.
ยง

impl<'a, T> OrPoisoned for Result<MutexGuard<'a, T>, PoisonError<MutexGuard<'a, T>>>

ยง

type Inner = MutexGuard<'a, T>

The inner guard type.
ยง

fn or_poisoned( self, ) -> <Result<MutexGuard<'a, T>, PoisonError<MutexGuard<'a, T>>> as OrPoisoned>::Inner

Unwraps the lock. Read more
ยง

impl<'a, T> OrPoisoned for Result<RwLockReadGuard<'a, T>, PoisonError<RwLockReadGuard<'a, T>>>

ยง

type Inner = RwLockReadGuard<'a, T>

The inner guard type.
ยง

fn or_poisoned( self, ) -> <Result<RwLockReadGuard<'a, T>, PoisonError<RwLockReadGuard<'a, T>>> as OrPoisoned>::Inner

Unwraps the lock. Read more
ยง

impl<'a, T> OrPoisoned for Result<RwLockWriteGuard<'a, T>, PoisonError<RwLockWriteGuard<'a, T>>>

ยง

type Inner = RwLockWriteGuard<'a, T>

The inner guard type.
ยง

fn or_poisoned( self, ) -> <Result<RwLockWriteGuard<'a, T>, PoisonError<RwLockWriteGuard<'a, T>>> as OrPoisoned>::Inner

Unwraps the lock. Read more
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,

Restrict a value to a certain interval. Read more
ยง

impl<T, U, E, F> PartialEq<ArchivedResult<T, E>> for Result<U, F>
where T: PartialEq<U>, E: PartialEq<F>,

ยง

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
ยง

impl<T, U, E, F> PartialEq<Result<T, E>> for ArchivedResult<U, F>
where U: PartialEq<T>, F: PartialEq<E>,

ยง

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

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

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> PartialEq for Result<T, E>
where T: PartialEq, E: PartialEq,

Sourceยง

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

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

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
ยง

impl<B, E> Policy<B, E> for Result<Action, E>
where E: Clone,

ยง

fn redirect(&mut self, _: &Attempt<'_>) -> Result<Action, E>

Invoked when the service received a response with a redirection status code (3xx). Read more
ยง

fn on_request(&mut self, _request: &mut Request<B>)

Invoked right before the service makes a request, regardless of whether it is redirected or not. Read more
ยง

fn clone_body(&self, _body: &B) -> Option<B>

Try to clone a request body before the service makes a redirected request. 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());
ยง

impl<T, E> Render for Result<T, E>
where T: Render, E: Into<Error> + 'static,

ยง

type State = ResultState<T>

The โ€œview stateโ€ for this type, which can be retained between updates. Read more
ยง

fn build(self) -> <Result<T, E> as Render>::State

Creates the view for the first time, without hydrating from existing HTML.
ยง

fn rebuild(self, state: &mut <Result<T, E> as Render>::State)

Updates the view with new data.
ยง

impl<T, E> RenderHtml for Result<T, E>
where T: RenderHtml, E: Into<Error> + Send + 'static,

ยง

const MIN_LENGTH: usize = T::MIN_LENGTH

The minimum length of HTML created when this view is rendered.
ยง

type AsyncOutput = Result<<T as RenderHtml>::AsyncOutput, E>

The type of the view after waiting for all asynchronous data to load.
ยง

type Owned = Result<<T as RenderHtml>::Owned, E>

An equivalent value that is 'static.
ยง

fn dry_resolve(&mut self)

โ€œRunsโ€ the view without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.
ยง

async fn resolve(self) -> <Result<T, E> as RenderHtml>::AsyncOutput

Waits for any asynchronous sections of the view to load and returns the output.
ยง

fn html_len(&self) -> usize

An estimated length for this view, when rendered to HTML. Read more
ยง

fn to_html_with_buf( self, buf: &mut String, position: &mut Position, escape: bool, mark_branches: bool, extra_attrs: Vec<AnyAttribute>, )

Renders a view to HTML, writing it into the given buffer.
ยง

fn to_html_async_with_buf<const OUT_OF_ORDER: bool>( self, buf: &mut StreamBuilder, position: &mut Position, escape: bool, mark_branches: bool, extra_attrs: Vec<AnyAttribute>, )
where Result<T, E>: Sized,

Renders a view into a buffer of (synchronous or asynchronous) HTML chunks.
ยง

fn hydrate<const FROM_SERVER: bool>( self, cursor: &Cursor, position: &PositionState, ) -> <Result<T, E> as Render>::State

Makes a set of DOM nodes rendered from HTML interactive. Read more
ยง

async fn hydrate_async( self, cursor: &Cursor, position: &PositionState, ) -> <Result<T, E> as Render>::State

Asynchronously makes a set of DOM nodes rendered from HTML interactive. Read more
ยง

fn into_owned(self) -> <Result<T, E> as RenderHtml>::Owned

Convert into the equivalent value that is 'static.
ยง

const EXISTS: bool = true

Whether this should actually exist in the DOM, if it is the child of an element.
ยง

fn to_html(self) -> String
where Self: Sized,

Renders a view to an HTML string.
ยง

fn to_html_branching(self) -> String
where Self: Sized,

Renders a view to HTML with branch markers. This can be used to support libraries that diff HTML pages against one another, by marking sections of the view that branch to different types with marker comments.
ยง

fn to_html_stream_in_order(self) -> StreamBuilder
where Self: Sized,

Renders a view to an in-order stream of HTML.
ยง

fn to_html_stream_in_order_branching(self) -> StreamBuilder
where Self: Sized,

Renders a view to an in-order stream of HTML with branch markers. This can be used to support libraries that diff HTML pages against one another, by marking sections of the view that branch to different types with marker comments.
ยง

fn to_html_stream_out_of_order(self) -> StreamBuilder
where Self: Sized,

Renders a view to an out-of-order stream of HTML.
ยง

fn to_html_stream_out_of_order_branching(self) -> StreamBuilder
where Self: Sized,

Renders a view to an out-of-order stream of HTML with branch markers. This can be used to support libraries that diff HTML pages against one another, by marking sections of the view that branch to different types with marker comments.
ยง

fn hydrate_from<const FROM_SERVER: bool>(self, el: &Element) -> Self::State
where Self: Sized,

Hydrates using RenderHtml::hydrate, beginning at the given element.
ยง

fn hydrate_from_position<const FROM_SERVER: bool>( self, el: &Element, position: Position, ) -> Self::State
where Self: Sized,

Hydrates using RenderHtml::hydrate, beginning at the given element and position.
Sourceยง

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

Sourceยง

type TryType = Result<T, E>

๐Ÿ”ฌThis is a nightly-only experimental API. (try_trait_v2_residual)
The โ€œreturnโ€ type of this meta-function.
ยง

impl<T> ResultDataError<T> for Result<T, DataError>

ยง

fn allow_identifier_not_found(self) -> Result<Option<T>, DataError>

Propagates all errors other than [DataErrorKind::IdentifierNotFound], and returns None in that case.
Sourceยง

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

Sourceยง

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.
ยง

impl<T, E, S> Serialize<S> for Result<T, E>
where T: Serialize<S>, E: Serialize<S>, S: Fallible + ?Sized,

ยง

fn serialize( &self, serializer: &mut S, ) -> Result<<Result<T, E> as Archive>::Resolver, <S as Fallible>::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
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
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.
ยง

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

ยง

fn is_success(&self) -> bool

Sourceยง

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

Sourceยง

type Output = T

๐Ÿ”ฌThis is a nightly-only experimental API. (try_trait_v2)
The type of the value produced by ? when not short-circuiting.
Sourceยง

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> TryWriteable for Result<T, E>
where T: Writeable, E: Writeable + Clone,

ยง

type Error = E

ยง

fn try_write_to<W>( &self, sink: &mut W, ) -> Result<Result<(), <Result<T, E> as TryWriteable>::Error>, Error>
where W: Write + ?Sized,

Writes the content of this writeable to a sink. Read more
ยง

fn try_write_to_parts<S>( &self, sink: &mut S, ) -> Result<Result<(), <Result<T, E> as TryWriteable>::Error>, Error>
where S: PartsWrite + ?Sized,

Writes the content of this writeable to a sink with parts (annotations). Read more
ยง

fn writeable_length_hint(&self) -> LengthHint

Returns a hint for the number of UTF-8 bytes that will be written to the sink. Read more
ยง

fn try_write_to_string( &self, ) -> Result<Cow<'_, str>, (<Result<T, E> as TryWriteable>::Error, Cow<'_, str>)>

Writes the content of this writeable to a string. Read more
Sourceยง

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

Sourceยง

fn unwrap_throw(self) -> T

Unwrap this Option or Result, but instead of panicking on failure, throw an exception to JavaScript.
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ยง

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

Sourceยง

type Prim3 = u32

If this Result is an Err, the error value.

Sourceยง

type Prim4 = u32

Whether this Result is an Err.

Sourceยง

type Prim1 = <T as WasmAbi>::Prim1

Sourceยง

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.
Sourceยง

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

Sourceยง

fn wrap_err<D>(self, msg: D) -> Result<T, Report>
where D: Display + Send + Sync + 'static,

Wrap the error value with a new adhoc error
Sourceยง

fn wrap_err_with<D, F>(self, msg: F) -> Result<T, Report>
where D: Display + Send + Sync + 'static, F: FnOnce() -> D,

Wrap the error value with a new adhoc error that is evaluated lazily only once an error does occur.
Sourceยง

fn context<D>(self, msg: D) -> Result<T, Report>
where D: Display + Send + Sync + 'static,

Compatibility re-export of wrap_err for interop with anyhow
Sourceยง

fn with_context<D, F>(self, msg: F) -> Result<T, Report>
where D: Display + Send + Sync + 'static, F: FnOnce() -> D,

Compatibility re-export of wrap_err_with for interop with anyhow
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>

Sourceยง

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

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<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Sourceยง

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Sourceยง

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
Sourceยง

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

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
ยง

impl<T> ArchivePointee for T

ยง

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
ยง

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
ยง

impl<T> ArchiveUnsized for T
where T: Archive,

ยง

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized. Read more
ยง

type MetadataResolver = ()

The resolver for the metadata of this type. Read more
ยง

unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )

Creates the archived version of the metadata for this value at the given position and writes it to the given output. Read more
ยง

unsafe fn resolve_unsized( &self, from: usize, to: usize, resolver: Self::MetadataResolver, out: *mut RelPtr<Self::Archived, <isize as Archive>::Archived>, )

Resolves a relative pointer to this value with the given from and to and writes it to the given output. Read more
Sourceยง

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Sourceยง

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Sourceยง

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Sourceยง

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
ยง

impl<V, Key, Sig, T> BindAttribute<Key, Sig, T> for V
where V: AddAnyAttr, Key: AttributeKey, Sig: IntoSplitSignal<Value = T>, T: FromEventTarget + AttributeValue + PartialEq + Sync + 'static, Signal<BoolOrT<T>>: IntoProperty, <Sig as IntoSplitSignal>::Read: Get<Value = T> + Send + Sync + Clone + 'static, <Sig as IntoSplitSignal>::Write: Send + Clone + 'static, Element: GetValue<T>,

ยง

type Output = <V as AddAnyAttr>::Output<Bind<Key, T, <Sig as IntoSplitSignal>::Read, <Sig as IntoSplitSignal>::Write>>

The type of the element with the two-way binding added.
ยง

fn bind( self, key: Key, signal: Sig, ) -> <V as BindAttribute<Key, Sig, T>>::Output

Adds a two-way binding to the element, which adds an attribute and an event listener to the element when the element is created or hydrated. Read more
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
ยง

impl<T> CallHasher for T
where T: Hash + ?Sized,

ยง

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

Sourceยง

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Sourceยง

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type thatโ€™s used in parameters when converting.
Sourceยง

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Sourceยง

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

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
ยง

impl<It, V> CollectView for It
where It: IntoIterator<Item = V>, V: IntoView,

ยง

type View = V

The inner view type.
ยง

fn collect_view(self) -> Vec<<It as CollectView>::View>

Collects the iterator into a list of views.
ยง

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.
Sourceยง

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Sourceยง

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
ยง

impl<T, K, V> CustomAttribute<K, V> for T
where T: AddAnyAttr, K: CustomAttributeKey, V: AttributeValue,

ยง

fn attr(self, key: K, value: V) -> Self::Output<CustomAttr<K, V>>

Adds an HTML attribute by key and value.
ยง

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

ยง

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
ยง

impl<V, T, P, D> DirectiveAttribute<T, P, D> for V
where V: AddAnyAttr, D: IntoDirective<T, P>, P: Clone + 'static, T: 'static,

ยง

type Output = <V as AddAnyAttr>::Output<Directive<T, D, P>>

The type of the element with the directive added.
ยง

fn directive( self, handler: D, param: P, ) -> <V as DirectiveAttribute<T, P, D>>::Output

Adds a directive to the element, which runs some custom logic in the browser when the element is created or hydrated.
ยง

impl<T> Downcast for T
where T: Any,

ยง

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
ยง

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
ยง

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Anyโ€™s vtable from &Traitโ€™s.
ยง

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Anyโ€™s vtable from &mut Traitโ€™s.
ยง

impl<T> DowncastSend for T
where T: Any + Send,

ยง

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
ยง

impl<T> DowncastSync for T
where T: Any + Send + Sync,

ยง

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
ยง

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
ยง

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.

Sourceยง

impl<T> FromAngle<T> for T

Sourceยง

fn from_angle(angle: T) -> T

Performs a conversion from angle.
ยง

impl<T> FromFormData for T

ยง

fn from_event(ev: &Event) -> Result<T, FromFormDataError>

Tries to deserialize the data, given only the submit event.
ยง

fn from_form_data(form_data: &FormData) -> Result<T, Error>

Tries to deserialize the data, given the actual form data.
ยง

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

ยง

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
ยง

impl<E, T, Request> FromReq<DeleteUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<E, T, Request> FromReq<GetUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<E, T, Request, Encoding> FromReq<Patch<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<E, T, Request> FromReq<PatchUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<E, T, Request, Encoding> FromReq<Post<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<E, T, Request> FromReq<PostUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<E, T, Request, Encoding> FromReq<Put<Encoding>, Request, E> for T
where Request: Req<E> + Send + 'static, Encoding: Decodes<T>, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<E, T, Request> FromReq<PutUrl, Request, E> for T
where Request: Req<E> + Send + 'static, T: DeserializeOwned, E: FromServerFnError,

ยง

async fn from_req(req: Request) -> Result<T, E>

Attempts to deserialize the arguments from a request.
ยง

impl<S, T> FromRequest<S, ViaParts> for T
where S: Send + Sync, T: FromRequestParts<S>,

ยง

type Rejection = <T as FromRequestParts<S>>::Rejection

If the extractor fails itโ€™ll use this โ€œrejectionโ€ type. A rejection is a kind of error that can be converted into a response.
ยง

fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>

Perform the extraction.
ยง

impl<E, Encoding, Response, T> FromRes<Patch<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

ยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
ยง

impl<E, Encoding, Response, T> FromRes<Post<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

ยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
ยง

impl<E, Encoding, Response, T> FromRes<Put<Encoding>, Response, E> for T
where Response: ClientRes<E> + Send, Encoding: Decodes<T>, E: FromServerFnError,

ยง

async fn from_res(res: Response) -> Result<T, E>

Attempts to deserialize the outputs from a response.
Sourceยง

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Sourceยง

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
ยง

impl<T, S> Handler<IntoResponseHandler, S> for T
where T: IntoResponse + Clone + Send + Sync + 'static,

ยง

type Future = Ready<Response<Body>>

The type of future calling this handler returns.
ยง

fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future

Call the handler with the given request.
ยง

fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>
where L: Layer<HandlerService<Self, T, S>> + Clone, <L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,

Apply a [tower::Layer] to the handler. Read more
ยง

fn with_state(self, state: S) -> HandlerService<Self, T, S>

Convert the handler into a [Service] by providing the state
ยง

impl<H, T> HandlerWithoutStateExt<T> for H
where H: Handler<T, ()>,

ยง

fn into_service(self) -> HandlerService<H, T, ()>

Convert the handler into a [Service] and no state.
ยง

fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>

Convert the handler into a MakeService and no state. Read more
ยง

fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>

Convert the handler into a MakeService which stores information about the incoming connection and has no state. Read more
Sourceยง

impl<T> Hexable for T
where T: Serialize + for<'de> Deserialize<'de>,

ยง

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, U> IntoAngle<U> for T
where U: FromAngle<T>,

Sourceยง

fn into_angle(self) -> U

Performs a conversion into T.
ยง

impl<T> IntoAny for T
where T: Send + RenderHtml,

ยง

fn into_any(self) -> AnyView

Converts the view into a type-erased AnyView.
Sourceยง

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Sourceยง

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type thatโ€™s used in parameters when converting.
Sourceยง

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Sourceยง

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Sourceยง

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Sourceยง

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Sourceยง

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
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<T> IntoMaybeErased for T
where T: RenderHtml,

ยง

type Output = T

The type of the output.
ยง

fn into_maybe_erased(self) -> <T as IntoMaybeErased>::Output

Converts the view into a type-erased view if in erased mode.
ยง

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> IntoRender for T
where T: Render,

ยง

type Output = T

The renderable type into which this type can be converted.
ยง

fn into_render(self) -> <T as IntoRender>::Output

Consumes this value, transforming it into the renderable type.
ยง

impl<E, T, Request> IntoReq<DeleteUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, T, Request> IntoReq<GetUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, T, Encoding, Request> IntoReq<Patch<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, T, Request> IntoReq<PatchUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, T, Encoding, Request> IntoReq<Post<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, T, Request> IntoReq<PostUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, T, Encoding, Request> IntoReq<Put<Encoding>, Request, E> for T
where Request: ClientReq<E>, Encoding: Encodes<T>, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, T, Request> IntoReq<PutUrl, Request, E> for T
where Request: ClientReq<E>, T: Serialize + Send, E: FromServerFnError,

ยง

fn into_req(self, path: &str, accepts: &str) -> Result<Request, E>

Attempts to serialize the arguments into an HTTP request.
ยง

impl<E, Response, Encoding, T> IntoRes<Patch<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

ยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
ยง

impl<E, Response, Encoding, T> IntoRes<Post<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

ยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
ยง

impl<E, Response, Encoding, T> IntoRes<Put<Encoding>, Response, E> for T
where Response: TryRes<E>, Encoding: Encodes<T>, E: FromServerFnError + Send, T: Send,

ยง

async fn into_res(self) -> Result<Response, E>

Attempts to serialize the output into an HTTP response.
Sourceยง

impl<T> IntoStimulus<T> for T

Sourceยง

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
ยง

impl<T> IntoView for T
where T: Render + RenderHtml + Send,

ยง

fn into_view(self) -> View<T>

Wraps the inner type.
ยง

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
ยง

impl<T> Pointee for T

ยง

type Metadata = ()

The type for metadata in pointers and references to Self.
ยง

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

ยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
ยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
ยง

impl<T> SerializableKey for T

ยง

fn ser_key(&self) -> String

Serializes the key to a unique string. Read more
ยง

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Serializer + ?Sized,

ยง

fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
ยง

fn serialize_metadata(&self, _: &mut S) -> Result<(), <S as Fallible>::Error>

Serializes the metadata for the given type.
ยง

impl<T> StorageAccess<T> for T

ยง

fn as_borrowed(&self) -> &T

Borrows the value.
ยง

fn into_taken(self) -> T

Takes the value.
Sourceยง

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

Sourceยง

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, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Sourceยง

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Sourceยง

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Sourceยง

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

Sourceยง

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>,

Sourceยง

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.
Sourceยง

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Sourceยง

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Sourceยง

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Sourceยง

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Sourceยง

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Sourceยง

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
ยง

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> CondSerialize for T
where T: Serialize,

Sourceยง

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

ยง

impl<T> ErasedDestructor for T
where T: 'static,

ยง

impl<T> Fruit for T
where T: Send + Downcast,