Trait otter_api_tests::imports::failure::_core::convert::From1.0.0[][src]

pub trait From<T> {
    #[lang = "from"]
    pub fn from(T) -> Self;
}

Used to do value-to-value conversions while consuming the input value. It is the reciprocal of Into.

One should always prefer implementing From over Into because implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Only implement Into when targeting a version prior to Rust 1.41 and converting to a type outside the current crate. From was not able to do these types of conversions in earlier versions because of Rust’s orphaning rules. See Into for more details.

Prefer using Into over using From when specifying trait bounds on a generic function. This way, types that directly implement Into can be used as arguments as well.

The From is also very useful when performing error handling. When constructing a function that is capable of failing, the return type will generally be of the form Result<T, E>. The From trait simplifies error handling by allowing a function to return a single error type that encapsulate multiple error types. See the “Examples” section and the book for more details.

Note: This trait must not fail. If the conversion can fail, use TryFrom.

Generic Implementations

  • From<T> for U implies Into<U> for T
  • From is reflexive, which means that From<T> for T is implemented

Examples

String implements From<&str>:

An explicit conversion from a &str to a String is done as follows:

let string = "hello".to_string();
let other_string = String::from("hello");

assert_eq!(string, other_string);

While performing error handling it is often useful to implement From for your own error type. By converting underlying error types to our own custom error type that encapsulates the underlying error type, we can return a single error type without losing information on the underlying cause. The ‘?’ operator automatically converts the underlying error type to our custom error type by calling Into<CliError>::into which is automatically provided when implementing From. The compiler then infers which implementation of Into should be used.

use std::fs;
use std::io;
use std::num;

enum CliError {
    IoError(io::Error),
    ParseError(num::ParseIntError),
}

impl From<io::Error> for CliError {
    fn from(error: io::Error) -> Self {
        CliError::IoError(error)
    }
}

impl From<num::ParseIntError> for CliError {
    fn from(error: num::ParseIntError) -> Self {
        CliError::ParseError(error)
    }
}

fn open_and_parse_file(file_name: &str) -> Result<i32, CliError> {
    let mut contents = fs::read_to_string(&file_name)?;
    let num: i32 = contents.trim().parse()?;
    Ok(num)
}

Required methods

#[lang = "from"]
pub fn from(T) -> Self
[src]

Performs the conversion.

Loading content...

Implementations on Foreign Types

impl<'_> From<&'_ OsStr> for Box<OsStr, Global>[src]

impl<'_> From<&'_ CStr> for Box<CStr, Global>[src]

impl From<u128> for Ipv6Addr[src]

pub fn from(ip: u128) -> Ipv6Addr[src]

Convert a host byte order u128 into an Ipv6Addr.

Examples

use std::net::Ipv6Addr;

let addr = Ipv6Addr::from(0x102030405060708090A0B0C0D0E0F00D_u128);
assert_eq!(
    Ipv6Addr::new(
        0x1020, 0x3040, 0x5060, 0x7080,
        0x90A0, 0xB0C0, 0xD0E0, 0xF00D,
    ),
    addr);

impl From<CString> for Box<CStr, Global>[src]

pub fn from(s: CString) -> Box<CStr, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a CString into a Box<CStr> without copying or allocating.

impl From<Ipv6Addr> for IpAddr[src]

pub fn from(ipv6: Ipv6Addr) -> IpAddr[src]

Copies this address to a new IpAddr::V6.

Examples

use std::net::{IpAddr, Ipv6Addr};

let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);

assert_eq!(
    IpAddr::V6(addr),
    IpAddr::from(addr)
);

impl From<Ipv6Addr> for u128[src]

pub fn from(ip: Ipv6Addr) -> u128[src]

Convert an Ipv6Addr into a host byte order u128.

Examples

use std::net::Ipv6Addr;

let addr = Ipv6Addr::new(
    0x1020, 0x3040, 0x5060, 0x7080,
    0x90A0, 0xB0C0, 0xD0E0, 0xF00D,
);
assert_eq!(0x102030405060708090A0B0C0D0E0F00D_u128, u128::from(addr));

impl From<PathBuf> for Box<Path, Global>[src]

pub fn from(p: PathBuf) -> Box<Path, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a PathBuf into a Box<Path>

This conversion currently should not allocate memory, but this behavior is not guaranteed on all platforms or in all future versions.

impl<'a> From<Cow<'a, str>> for Box<dyn Error + 'static, Global>[src]

pub fn from(err: Cow<'a, str>) -> Box<dyn Error + 'static, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a Cow into a box of dyn Error.

Examples

use std::error::Error;
use std::mem;
use std::borrow::Cow;

let a_cow_str_error = Cow::from("a str error");
let a_boxed_error = Box::<dyn Error>::from(a_cow_str_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))

impl From<[u16; 8]> for IpAddr[src]

pub fn from(segments: [u16; 8]) -> IpAddr[src]

Creates an IpAddr::V6 from an eight element 16-bit array.

Examples

use std::net::{IpAddr, Ipv6Addr};

let addr = IpAddr::from([
    525u16, 524u16, 523u16, 522u16,
    521u16, 520u16, 519u16, 518u16,
]);
assert_eq!(
    IpAddr::V6(Ipv6Addr::new(
        0x20d, 0x20c,
        0x20b, 0x20a,
        0x209, 0x208,
        0x207, 0x206
    )),
    addr
);

impl From<CString> for Vec<u8, Global>[src]

pub fn from(s: CString) -> Vec<u8, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Converts a CString into a Vec<u8>.

The conversion consumes the CString, and removes the terminating NUL byte.

impl<'_> From<&'_ str> for Box<dyn Error + 'static, Global>[src]

pub fn from(err: &str) -> Box<dyn Error + 'static, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a str into a box of dyn Error.

Examples

use std::error::Error;
use std::mem;

let a_str_error = "a str error";
let a_boxed_error = Box::<dyn Error>::from(a_str_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))

impl From<String> for OsString[src]

pub fn from(s: String) -> OsString[src]

Converts a String into a OsString.

This conversion does not allocate or copy memory.

impl<'a, E> From<E> for Box<dyn Error + 'a + Sync + Send, Global> where
    E: 'a + Error + Send + Sync
[src]

pub fn from(err: E) -> Box<dyn Error + 'a + Sync + Send, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a type of Error + Send + Sync into a box of dyn Error + Send + Sync.

Examples

use std::error::Error;
use std::fmt;
use std::mem;

#[derive(Debug)]
struct AnError;

impl fmt::Display for AnError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f , "An error")
    }
}

impl Error for AnError {}

unsafe impl Send for AnError {}

unsafe impl Sync for AnError {}

let an_error = AnError;
assert!(0 == mem::size_of_val(&an_error));
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(an_error);
assert!(
    mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))

impl From<OsString> for Rc<OsStr>[src]

pub fn from(s: OsString) -> Rc<OsStr>[src]

Converts a OsString into a Rc<OsStr> without copying or allocating.

impl From<Box<OsStr, Global>> for OsString[src]

pub fn from(boxed: Box<OsStr, Global>) -> OsString[src]

Converts a Box<OsStr> into an OsString without copying or allocating.

impl From<SocketAddrV6> for SocketAddr[src]

pub fn from(sock6: SocketAddrV6) -> SocketAddr[src]

Converts a SocketAddrV6 into a SocketAddr::V6.

impl<'_> From<Cow<'_, Path>> for Box<Path, Global>[src]

impl From<PathBuf> for Rc<Path>[src]

pub fn from(s: PathBuf) -> Rc<Path>[src]

Converts a PathBuf into an Rc by moving the PathBuf data into a new Rc buffer.

impl From<Ipv4Addr> for IpAddr[src]

pub fn from(ipv4: Ipv4Addr) -> IpAddr[src]

Copies this address to a new IpAddr::V4.

Examples

use std::net::{IpAddr, Ipv4Addr};

let addr = Ipv4Addr::new(127, 0, 0, 1);

assert_eq!(
    IpAddr::V4(addr),
    IpAddr::from(addr)
)

impl From<String> for Box<dyn Error + 'static + Sync + Send, Global>[src]

pub fn from(err: String) -> Box<dyn Error + 'static + Sync + Send, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a String into a box of dyn Error + Send + Sync.

Examples

use std::error::Error;
use std::mem;

let a_string_error = "a string error".to_string();
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(a_string_error);
assert!(
    mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))

impl<'a> From<Cow<'a, CStr>> for CString[src]

impl<T> From<PoisonError<T>> for TryLockError<T>[src]

impl<'_> From<&'_ CStr> for CString[src]

impl From<Box<CStr, Global>> for CString[src]

pub fn from(s: Box<CStr, Global>) -> CString[src]

Converts a Box<CStr> into a CString without copying or allocating.

impl From<[u8; 4]> for IpAddr[src]

pub fn from(octets: [u8; 4]) -> IpAddr[src]

Creates an IpAddr::V4 from a four element byte array.

Examples

use std::net::{IpAddr, Ipv4Addr};

let addr = IpAddr::from([13u8, 12u8, 11u8, 10u8]);
assert_eq!(IpAddr::V4(Ipv4Addr::new(13, 12, 11, 10)), addr);

impl<'a, E> From<E> for Box<dyn Error + 'a, Global> where
    E: 'a + Error
[src]

pub fn from(err: E) -> Box<dyn Error + 'a, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a type of Error into a box of dyn Error.

Examples

use std::error::Error;
use std::fmt;
use std::mem;

#[derive(Debug)]
struct AnError;

impl fmt::Display for AnError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f , "An error")
    }
}

impl Error for AnError {}

let an_error = AnError;
assert!(0 == mem::size_of_val(&an_error));
let a_boxed_error = Box::<dyn Error>::from(an_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))

impl<T> From<T> for SyncOnceCell<T>[src]

impl<'a, '_> From<&'_ str> for Box<dyn Error + 'a + Sync + Send, Global>[src]

pub fn from(err: &str) -> Box<dyn Error + 'a + Sync + Send, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a str into a box of dyn Error + Send + Sync.

Examples

use std::error::Error;
use std::mem;

let a_str_error = "a str error";
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(a_str_error);
assert!(
    mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))

impl From<OsString> for Box<OsStr, Global>[src]

pub fn from(s: OsString) -> Box<OsStr, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a OsString into a Box<OsStr> without copying or allocating.

impl<'_> From<&'_ OsStr> for Rc<OsStr>[src]

impl<'_> From<&'_ Path> for Rc<Path>[src]

pub fn from(s: &Path) -> Rc<Path>[src]

Converts a Path into an Rc by copying the Path data into a new Rc buffer.

impl<'_> From<Cow<'_, CStr>> for Box<CStr, Global>[src]

impl From<PathBuf> for OsString[src]

pub fn from(path_buf: PathBuf) -> OsString[src]

Converts a PathBuf into an OsString

This conversion does not allocate or copy memory.

impl From<[u8; 16]> for IpAddr[src]

pub fn from(octets: [u8; 16]) -> IpAddr[src]

Creates an IpAddr::V6 from a sixteen element byte array.

Examples

use std::net::{IpAddr, Ipv6Addr};

let addr = IpAddr::from([
    25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,
    17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,
]);
assert_eq!(
    IpAddr::V6(Ipv6Addr::new(
        0x1918, 0x1716,
        0x1514, 0x1312,
        0x1110, 0x0f0e,
        0x0d0c, 0x0b0a
    )),
    addr
);

impl<T> From<T> for RwLock<T>[src]

pub fn from(t: T) -> RwLock<T>[src]

Creates a new instance of an RwLock<T> which is unlocked. This is equivalent to RwLock::new.

impl<'a> From<Cow<'a, OsStr>> for OsString[src]

impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + 'a + Sync + Send, Global>[src]

pub fn from(err: Cow<'b, str>) -> Box<dyn Error + 'a + Sync + Send, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a Cow into a box of dyn Error + Send + Sync.

Examples

use std::error::Error;
use std::mem;
use std::borrow::Cow;

let a_cow_str_error = Cow::from("a str error");
let a_boxed_error = Box::<dyn Error + Send + Sync>::from(a_cow_str_error);
assert!(
    mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))

impl<'_> From<&'_ CStr> for Rc<CStr>[src]

impl From<u32> for Ipv4Addr[src]

pub fn from(ip: u32) -> Ipv4Addr[src]

Converts a host byte order u32 into an Ipv4Addr.

Examples

use std::net::Ipv4Addr;

let addr = Ipv4Addr::from(0xcafebabe);
assert_eq!(Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe), addr);

impl From<Vec<NonZeroU8, Global>> for CString[src]

pub fn from(v: Vec<NonZeroU8, Global>) -> CString[src]

Converts a Vec<NonZeroU8> into a CString without copying nor checking for inner null bytes.

impl<T> From<T> for Mutex<T>[src]

pub fn from(t: T) -> Mutex<T>[src]

Creates a new mutex in an unlocked state ready for use. This is equivalent to Mutex::new.

impl<'_> From<&'_ Path> for Box<Path, Global>[src]

impl From<SocketAddrV4> for SocketAddr[src]

pub fn from(sock4: SocketAddrV4) -> SocketAddr[src]

Converts a SocketAddrV4 into a SocketAddr::V4.

impl<I> From<(I, u16)> for SocketAddr where
    I: Into<IpAddr>, 
[src]

pub fn from(pieces: (I, u16)) -> SocketAddr[src]

Converts a tuple struct (Into<IpAddr>, u16) into a SocketAddr.

This conversion creates a SocketAddr::V4 for a IpAddr::V4 and creates a SocketAddr::V6 for a IpAddr::V6.

u16 is treated as port of the newly created SocketAddr.

impl<'_, T> From<&'_ T> for OsString where
    T: AsRef<OsStr> + ?Sized
[src]

impl From<CString> for Rc<CStr>[src]

pub fn from(s: CString) -> Rc<CStr>[src]

Converts a CString into a Rc<CStr> without copying or allocating.

impl<'_> From<Cow<'_, OsStr>> for Box<OsStr, Global>[src]

impl From<[u8; 4]> for Ipv4Addr[src]

pub fn from(octets: [u8; 4]) -> Ipv4Addr[src]

Creates an Ipv4Addr from a four element byte array.

Examples

use std::net::Ipv4Addr;

let addr = Ipv4Addr::from([13u8, 12u8, 11u8, 10u8]);
assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);

impl From<String> for Box<dyn Error + 'static, Global>[src]

pub fn from(str_err: String) -> Box<dyn Error + 'static, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a String into a box of dyn Error.

Examples

use std::error::Error;
use std::mem;

let a_string_error = "a string error".to_string();
let a_boxed_error = Box::<dyn Error>::from(a_string_error);
assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))

impl From<[u8; 16]> for Ipv6Addr[src]

pub fn from(octets: [u8; 16]) -> Ipv6Addr[src]

Creates an Ipv6Addr from a sixteen element byte array.

Examples

use std::net::Ipv6Addr;

let addr = Ipv6Addr::from([
    25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,
    17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,
]);
assert_eq!(
    Ipv6Addr::new(
        0x1918, 0x1716,
        0x1514, 0x1312,
        0x1110, 0x0f0e,
        0x0d0c, 0x0b0a
    ),
    addr
);

impl From<[u16; 8]> for Ipv6Addr[src]

pub fn from(segments: [u16; 8]) -> Ipv6Addr[src]

Creates an Ipv6Addr from an eight element 16-bit array.

Examples

use std::net::Ipv6Addr;

let addr = Ipv6Addr::from([
    525u16, 524u16, 523u16, 522u16,
    521u16, 520u16, 519u16, 518u16,
]);
assert_eq!(
    Ipv6Addr::new(
        0x20d, 0x20c,
        0x20b, 0x20a,
        0x209, 0x208,
        0x207, 0x206
    ),
    addr
);

impl From<Ipv4Addr> for u32[src]

pub fn from(ip: Ipv4Addr) -> u32[src]

Converts an Ipv4Addr into a host byte order u32.

Examples

use std::net::Ipv4Addr;

let addr = Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe);
assert_eq!(0xcafebabe, u32::from(addr));

impl From<NonZeroU32> for u32[src]

pub fn from(nonzero: NonZeroU32) -> u32[src]

Converts a NonZeroU32 into an u32

impl From<i16> for f64[src]

Converts i16 to f64 losslessly.

impl From<bool> for i8[src]

Converts a bool to a i8. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(i8::from(true), 1);
assert_eq!(i8::from(false), 0);

impl From<NonZeroU16> for u16[src]

pub fn from(nonzero: NonZeroU16) -> u16[src]

Converts a NonZeroU16 into an u16

impl From<f32> for f64[src]

Converts f32 to f64 losslessly.

impl From<u16> for u64[src]

Converts u16 to u64 losslessly.

impl From<NonZeroU128> for u128[src]

pub fn from(nonzero: NonZeroU128) -> u128[src]

Converts a NonZeroU128 into an u128

impl From<i32> for f64[src]

Converts i32 to f64 losslessly.

impl From<u64> for i128[src]

Converts u64 to i128 losslessly.

impl From<u8> for u16[src]

Converts u8 to u16 losslessly.

impl From<u16> for u128[src]

Converts u16 to u128 losslessly.

impl From<i8> for f64[src]

Converts i8 to f64 losslessly.

impl From<u8> for i64[src]

Converts u8 to i64 losslessly.

impl From<u32> for u128[src]

Converts u32 to u128 losslessly.

impl From<bool> for u128[src]

Converts a bool to a u128. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(u128::from(true), 1);
assert_eq!(u128::from(false), 0);

impl From<u8> for i32[src]

Converts u8 to i32 losslessly.

impl From<u64> for u128[src]

Converts u64 to u128 losslessly.

impl From<i32> for i128[src]

Converts i32 to i128 losslessly.

impl From<u32> for i128[src]

Converts u32 to i128 losslessly.

impl From<bool> for u32[src]

Converts a bool to a u32. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(u32::from(true), 1);
assert_eq!(u32::from(false), 0);

impl From<bool> for u8[src]

Converts a bool to a u8. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(u8::from(true), 1);
assert_eq!(u8::from(false), 0);

impl From<i16> for i64[src]

Converts i16 to i64 losslessly.

impl From<u16> for u32[src]

Converts u16 to u32 losslessly.

impl From<bool> for i64[src]

Converts a bool to a i64. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(i64::from(true), 1);
assert_eq!(i64::from(false), 0);

impl From<i16> for i32[src]

Converts i16 to i32 losslessly.

impl From<i32> for i64[src]

Converts i32 to i64 losslessly.

impl From<u8> for u64[src]

Converts u8 to u64 losslessly.

impl From<NonZeroU8> for u8[src]

pub fn from(nonzero: NonZeroU8) -> u8[src]

Converts a NonZeroU8 into an u8

impl From<bool> for i128[src]

Converts a bool to a i128. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(i128::from(true), 1);
assert_eq!(i128::from(false), 0);

impl From<bool> for isize[src]

Converts a bool to a isize. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(isize::from(true), 1);
assert_eq!(isize::from(false), 0);

impl From<NonZeroI64> for i64[src]

pub fn from(nonzero: NonZeroI64) -> i64[src]

Converts a NonZeroI64 into an i64

impl From<char> for u64[src]

pub fn from(c: char) -> u64[src]

Converts a char into a u64.

Examples

use std::mem;

let c = '👤';
let u = u64::from(c);
assert!(8 == mem::size_of_val(&u))

impl From<u16> for usize[src]

Converts u16 to usize losslessly.

impl From<NonZeroI8> for i8[src]

pub fn from(nonzero: NonZeroI8) -> i8[src]

Converts a NonZeroI8 into an i8

impl From<u8> for i16[src]

Converts u8 to i16 losslessly.

impl From<i8> for i32[src]

Converts i8 to i32 losslessly.

impl From<char> for u128[src]

pub fn from(c: char) -> u128[src]

Converts a char into a u128.

Examples

use std::mem;

let c = '⚙';
let u = u128::from(c);
assert!(16 == mem::size_of_val(&u))

impl From<u32> for f64[src]

Converts u32 to f64 losslessly.

impl From<NonZeroI16> for i16[src]

pub fn from(nonzero: NonZeroI16) -> i16[src]

Converts a NonZeroI16 into an i16

impl From<u32> for i64[src]

Converts u32 to i64 losslessly.

impl From<char> for u32[src]

pub fn from(c: char) -> u32[src]

Converts a char into a u32.

Examples

use std::mem;

let c = 'c';
let u = u32::from(c);
assert!(4 == mem::size_of_val(&u))

impl From<i8> for i16[src]

Converts i8 to i16 losslessly.

impl From<i8> for isize[src]

Converts i8 to isize losslessly.

impl From<i16> for i128[src]

Converts i16 to i128 losslessly.

impl From<NonZeroUsize> for usize[src]

pub fn from(nonzero: NonZeroUsize) -> usize[src]

Converts a NonZeroUsize into an usize

impl From<u8> for i128[src]

Converts u8 to i128 losslessly.

impl From<u16> for f32[src]

Converts u16 to f32 losslessly.

impl From<NonZeroI32> for i32[src]

pub fn from(nonzero: NonZeroI32) -> i32[src]

Converts a NonZeroI32 into an i32

impl From<bool> for usize[src]

Converts a bool to a usize. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(usize::from(true), 1);
assert_eq!(usize::from(false), 0);

impl From<u16> for f64[src]

Converts u16 to f64 losslessly.

impl From<u8> for f32[src]

Converts u8 to f32 losslessly.

impl From<i16> for isize[src]

Converts i16 to isize losslessly.

impl From<u8> for usize[src]

Converts u8 to usize losslessly.

impl From<NonZeroIsize> for isize[src]

pub fn from(nonzero: NonZeroIsize) -> isize[src]

Converts a NonZeroIsize into an isize

impl From<u16> for i64[src]

Converts u16 to i64 losslessly.

impl From<NonZeroU64> for u64[src]

pub fn from(nonzero: NonZeroU64) -> u64[src]

Converts a NonZeroU64 into an u64

impl From<NonZeroI128> for i128[src]

pub fn from(nonzero: NonZeroI128) -> i128[src]

Converts a NonZeroI128 into an i128

impl From<u8> for f64[src]

Converts u8 to f64 losslessly.

impl From<bool> for i16[src]

Converts a bool to a i16. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(i16::from(true), 1);
assert_eq!(i16::from(false), 0);

impl From<u8> for char[src]

Maps a byte in 0x00..=0xFF to a char whose code point has the same value, in U+0000..=U+00FF.

Unicode is designed such that this effectively decodes bytes with the character encoding that IANA calls ISO-8859-1. This encoding is compatible with ASCII.

Note that this is different from ISO/IEC 8859-1 a.k.a. ISO 8859-1 (with one less hyphen), which leaves some “blanks”, byte values that are not assigned to any character. ISO-8859-1 (the IANA one) assigns them to the C0 and C1 control codes.

Note that this is also different from Windows-1252 a.k.a. code page 1252, which is a superset ISO/IEC 8859-1 that assigns some (not all!) blanks to punctuation and various Latin characters.

To confuse things further, on the Web ascii, iso-8859-1, and windows-1252 are all aliases for a superset of Windows-1252 that fills the remaining blanks with corresponding C0 and C1 control codes.

pub fn from(i: u8) -> char[src]

Converts a u8 into a char.

Examples

use std::mem;

let u = 32 as u8;
let c = char::from(u);
assert!(4 == mem::size_of_val(&c))

impl From<u8> for u32[src]

Converts u8 to u32 losslessly.

impl From<i8> for i128[src]

Converts i8 to i128 losslessly.

impl From<i16> for f32[src]

Converts i16 to f32 losslessly.

impl From<i8> for i64[src]

Converts i8 to i64 losslessly.

impl From<u16> for i32[src]

Converts u16 to i32 losslessly.

impl From<i64> for i128[src]

Converts i64 to i128 losslessly.

impl From<u32> for u64[src]

Converts u32 to u64 losslessly.

impl From<i8> for f32[src]

Converts i8 to f32 losslessly.

impl From<u8> for isize[src]

Converts u8 to isize losslessly.

impl From<bool> for u64[src]

Converts a bool to a u64. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(u64::from(true), 1);
assert_eq!(u64::from(false), 0);

impl From<bool> for i32[src]

Converts a bool to a i32. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(i32::from(true), 1);
assert_eq!(i32::from(false), 0);

impl From<bool> for u16[src]

Converts a bool to a u16. The resulting value is 0 for false and 1 for true values.

Examples

assert_eq!(u16::from(true), 1);
assert_eq!(u16::from(false), 0);

impl From<u8> for u128[src]

Converts u8 to u128 losslessly.

impl From<u16> for i128[src]

Converts u16 to i128 losslessly.

impl From<String> for Vec<u8, Global>[src]

pub fn from(string: String) -> Vec<u8, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Converts the given String to a vector Vec that holds values of type u8.

Examples

Basic usage:

let s1 = String::from("hello world");
let v1 = Vec::from(s1);

for b in v1 {
    println!("{}", b);
}

impl<T, A> From<Vec<T, A>> for Box<[T], A> where
    A: Allocator
[src]

pub fn from(v: Vec<T, A>) -> Box<[T], A>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Convert a vector into a boxed slice.

If v has excess capacity, its items will be moved into a newly-allocated buffer with exactly the right capacity.

Examples

assert_eq!(Box::from(vec![1, 2, 3]), vec![1, 2, 3].into_boxed_slice());

impl<T> From<T> for Rc<T>[src]

impl<T> From<T> for Box<T, Global>[src]

pub fn from(t: T) -> Box<T, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a generic type T into a Box<T>

The conversion allocates on the heap and moves t from the stack into it.

Examples

let x = 5;
let boxed = Box::new(5);

assert_eq!(Box::from(x), boxed);

impl<T> From<BinaryHeap<T>> for Vec<T, Global>[src]

pub fn from(heap: BinaryHeap<T>) -> Vec<T, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Converts a BinaryHeap<T> into a Vec<T>.

This conversion requires no data movement or allocation, and has constant time complexity.

impl<T> From<Vec<T, Global>> for BinaryHeap<T> where
    T: Ord
[src]

pub fn from(vec: Vec<T, Global>) -> BinaryHeap<T>[src]

Converts a Vec<T> into a BinaryHeap<T>.

This conversion happens in-place, and has O(n) time complexity.

impl<T> From<Box<T, Global>> for Rc<T> where
    T: ?Sized
[src]

pub fn from(v: Box<T, Global>) -> Rc<T>[src]

Move a boxed object to a new, reference counted, allocation.

Example

let original: Box<i32> = Box::new(1);
let shared: Rc<i32> = Rc::from(original);
assert_eq!(1, *shared);

impl<T, const N: usize> From<[T; N]> for Vec<T, Global>[src]

impl<'_> From<Cow<'_, str>> for Box<str, Global>[src]

impl From<LayoutError> for TryReserveError[src]

impl<T, const N: usize> From<[T; N]> for Box<[T], Global>[src]

pub fn from(array: [T; N]) -> Box<[T], Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a [T; N] into a Box<[T]>

This conversion moves the array to newly heap-allocated memory.

Examples

let boxed: Box<[u8]> = Box::from([4, 2]);
println!("{:?}", boxed);

impl<'_> From<&'_ str> for Rc<str>[src]

pub fn from(v: &str) -> Rc<str>[src]

Allocate a reference-counted string slice and copy v into it.

Example

let shared: Rc<str> = Rc::from("statue");
assert_eq!("statue", &shared[..]);

impl<'a, T> From<Cow<'a, [T]>> for Vec<T, Global> where
    [T]: ToOwned,
    <[T] as ToOwned>::Owned == Vec<T, Global>, 
[src]

pub fn from(s: Cow<'a, [T]>) -> Vec<T, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Convert a clone-on-write slice into a vector.

If s already owns a Vec<T>, it will be returned directly. If s is borrowing a slice, a new Vec<T> will be allocated and filled by cloning s’s items into it.

Examples

let o: Cow<[i32]> = Cow::Owned(vec![1, 2, 3]);
let b: Cow<[i32]> = Cow::Borrowed(&[1, 2, 3]);
assert_eq!(Vec::from(o), Vec::from(b));

impl<'_, T> From<&'_ [T]> for Box<[T], Global> where
    T: Copy
[src]

pub fn from(slice: &[T]) -> Box<[T], Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a &[T] into a Box<[T]>

This conversion allocates on the heap and performs a copy of slice.

Examples

// create a &[u8] which will be used to create a Box<[u8]>
let slice: &[u8] = &[104, 101, 108, 108, 111];
let boxed_slice: Box<[u8]> = Box::from(slice);

println!("{:?}", boxed_slice);

impl From<String> for Box<str, Global>[src]

pub fn from(s: String) -> Box<str, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts the given String to a boxed str slice that is owned.

Examples

Basic usage:

let s1: String = String::from("hello world");
let s2: Box<str> = Box::from(s1);
let s3: String = String::from(s2);

assert_eq!("hello world", s3)

impl<'_> From<&'_ mut str> for String[src]

pub fn from(s: &mut str) -> String[src]

Converts a &mut str into a String.

The result is allocated on the heap.

impl<'_> From<&'_ str> for String[src]

impl<T> From<VecDeque<T>> for Vec<T, Global>[src]

pub fn from(other: VecDeque<T>) -> Vec<T, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Turn a VecDeque<T> into a Vec<T>.

This never needs to re-allocate, but does need to do O(n) data movement if the circular buffer doesn’t happen to be at the beginning of the allocation.

Examples

use std::collections::VecDeque;

// This one is *O*(1).
let deque: VecDeque<_> = (1..5).collect();
let ptr = deque.as_slices().0.as_ptr();
let vec = Vec::from(deque);
assert_eq!(vec, [1, 2, 3, 4]);
assert_eq!(vec.as_ptr(), ptr);

// This one needs data rearranging.
let mut deque: VecDeque<_> = (1..5).collect();
deque.push_front(9);
deque.push_front(8);
let ptr = deque.as_slices().1.as_ptr();
let vec = Vec::from(deque);
assert_eq!(vec, [8, 9, 1, 2, 3, 4]);
assert_eq!(vec.as_ptr(), ptr);

impl<'_, T> From<&'_ [T]> for Rc<[T]> where
    T: Clone
[src]

pub fn from(v: &[T]) -> Rc<[T]>[src]

Allocate a reference-counted slice and fill it by cloning v’s items.

Example

let original: &[i32] = &[1, 2, 3];
let shared: Rc<[i32]> = Rc::from(original);
assert_eq!(&[1, 2, 3], &shared[..]);

impl<T, A> From<Box<[T], A>> for Vec<T, A> where
    A: Allocator
[src]

pub fn from(s: Box<[T], A>) -> Vec<T, A>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Convert a boxed slice into a vector by transferring ownership of the existing heap allocation.

Examples

let b: Box<[i32]> = vec![1, 2, 3].into_boxed_slice();
assert_eq!(Vec::from(b), vec![1, 2, 3]);

impl<'_, T> From<&'_ [T]> for Vec<T, Global> where
    T: Clone
[src]

pub fn from(s: &[T]) -> Vec<T, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Allocate a Vec<T> and fill it by cloning s’s items.

Examples

assert_eq!(Vec::from(&[1, 2, 3][..]), vec![1, 2, 3]);

impl<'a, B> From<Cow<'a, B>> for Rc<B> where
    B: ToOwned + ?Sized,
    Rc<B>: From<&'a B>,
    Rc<B>: From<<B as ToOwned>::Owned>, 
[src]

impl<'a> From<Cow<'a, str>> for String[src]

impl From<Box<str, Global>> for String[src]

pub fn from(s: Box<str, Global>) -> String[src]

Converts the given boxed str slice to a String. It is notable that the str slice is owned.

Examples

Basic usage:

let s1: String = String::from("hello world");
let s2: Box<str> = s1.into_boxed_str();
let s3: String = String::from(s2);

assert_eq!("hello world", s3)

impl<T> From<Vec<T, Global>> for Rc<[T]>[src]

pub fn from(v: Vec<T, Global>) -> Rc<[T]>[src]

Allocate a reference-counted slice and move v’s items into it.

Example

let original: Box<Vec<i32>> = Box::new(vec![1, 2, 3]);
let shared: Rc<Vec<i32>> = Rc::from(original);
assert_eq!(vec![1, 2, 3], *shared);

impl<'_> From<&'_ str> for Vec<u8, Global>[src]

pub fn from(s: &str) -> Vec<u8, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Allocate a Vec<u8> and fill it with a UTF-8 string.

Examples

assert_eq!(Vec::from("123"), vec![b'1', b'2', b'3']);

impl<'_, T> From<&'_ mut [T]> for Vec<T, Global> where
    T: Clone
[src]

pub fn from(s: &mut [T]) -> Vec<T, Global>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Allocate a Vec<T> and fill it by cloning s’s items.

Examples

assert_eq!(Vec::from(&mut [1, 2, 3][..]), vec![1, 2, 3]);

impl From<String> for Rc<str>[src]

pub fn from(v: String) -> Rc<str>[src]

Allocate a reference-counted string slice and copy v into it.

Example

let original: String = "statue".to_owned();
let shared: Rc<str> = Rc::from(original);
assert_eq!("statue", &shared[..]);

impl<'_> From<&'_ String> for String[src]

impl<'_, T> From<Cow<'_, [T]>> for Box<[T], Global> where
    T: Copy
[src]

impl<A> From<Box<str, A>> for Box<[u8], A> where
    A: Allocator
[src]

pub fn from(s: Box<str, A>) -> Box<[u8], A>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a Box<str> into a Box<[u8]>

This conversion does not allocate on the heap and happens in place.

Examples

// create a Box<str> which will be used to create a Box<[u8]>
let boxed: Box<str> = Box::from("hello");
let boxed_str: Box<[u8]> = Box::from(boxed);

// create a &[u8] which will be used to create a Box<[u8]>
let slice: &[u8] = &[104, 101, 108, 108, 111];
let boxed_slice = Box::from(slice);

assert_eq!(boxed_slice, boxed_str);

impl From<char> for String[src]

impl<'_> From<&'_ str> for Box<str, Global>[src]

pub fn from(s: &str) -> Box<str, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?Sized
impl<F, A> Future for Box<F, A> where
    A: Allocator + 'static,
    F: Future + Unpin + ?Sized
type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
    A: Allocator,
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;
[src]

Converts a &str into a Box<str>

This conversion allocates on the heap and performs a copy of s.

Examples

let boxed: Box<str> = Box::from("hello");
println!("{}", boxed);

impl From<DescId> for usize[src]

impl From<FaceId> for usize[src]

impl From<GoodItemName> for String[src]

impl From<FaceId> for u8[src]

impl From<User> for u8[src]

impl From<CompassAngle> for u8[src]

impl From<OccId> for String[src]

impl From<InHand> for usize[src]

impl<T> From<OldNew<T>> for [T; 2][src]

impl From<VisiblePieceId> for String[src]

impl From<Notch> for u32[src]

impl From<SvgId> for usize[src]

impl From<Notch> for usize[src]

impl From<PlayerId> for String[src]

impl From<ClientId> for String[src]

impl<'a, T, U> From<&'a T> for SerializeAsWrap<'a, T, U> where
    T: ?Sized,
    U: SerializeAs<T> + ?Sized
[src]

impl From<Error> for Box<dyn Error + 'static + Sync + Send, Global>[src]

impl From<Error> for Box<dyn Error + 'static + Send, Global>[src]

impl From<Error> for Box<dyn Error + 'static, Global>[src]

impl<'t> From<Match<'t>> for &'t str

impl From<Error> for Error

impl From<Error> for Error

impl From<SystemTime> for Timestamp[src]

impl From<Duration> for Duration[src]

impl From<Error> for Box<dyn Error + 'static + Sync + Send, Global>

impl From<Error> for Box<dyn Error + 'static, Global>

impl From<Vec<BacktraceFrame, Global>> for Backtrace[src]

impl<T> From<DebugTypesOffset<T>> for UnitSectionOffset<T>

impl<R> From<R> for DebugLoc<R>

impl<R> From<R> for EhFrameHdr<R> where
    R: Reader, 

impl<R> From<R> for DebugLineStr<R>

impl<R> From<R> for DebugInfo<R>

impl<R> From<R> for DebugTypes<R>

impl<R> From<R> for EhFrame<R> where
    R: Reader, 

impl<R> From<R> for DebugLine<R>

impl<R> From<R> for DebugFrame<R> where
    R: Reader, 

impl<R> From<R> for DebugPubNames<R> where
    R: Reader, 

impl<T> From<DebugInfoOffset<T>> for UnitSectionOffset<T>

impl<T> From<T> for EhFrameOffset<T>

impl<R> From<R> for DebugRngLists<R>

impl<R> From<R> for DebugStr<R>

impl<R> From<R> for DebugLocLists<R>

impl<R> From<R> for DebugAbbrev<R>

impl<R> From<R> for DebugRanges<R>

impl<R> From<R> for DebugPubTypes<R> where
    R: Reader, 

impl<R> From<R> for DebugAddr<R>

impl<R> From<R> for DebugAranges<R> where
    R: Reader, 

impl<T> From<T> for DebugFrameOffset<T>

impl<R> From<R> for DebugStrOffsets<R>

impl<E> From<Rel32<E>> for Rela32<E> where
    E: Endian, 

impl<E> From<Rel64<E>> for Rela64<E> where
    E: Endian, 

impl From<MZFlush> for TDEFLFlush

impl From<Error> for Error

impl From<SystemTime> for FileTime

impl From<usize> for Token[src]

impl From<Token> for usize[src]

impl From<Ready> for UnixReady[src]

impl From<ReadinessState> for usize[src]

impl From<UnixReady> for Ready[src]

impl<T> From<SendError<T>> for SendError<T>

impl<T> From<TrySendError<T>> for TrySendError<T>

impl<T> From<Error> for TrySendError<T>

impl<T> From<Error> for SendError<T>

impl<T> From<SendError<T>> for TrySendError<T>

impl From<Span> for (usize, usize)[src]

impl<I, T> From<IndexVec<I, T>> for Box<IndexSlice<I, [T]>, Global> where
    I: Idx

impl<I, T> From<Box<[T], Global>> for Box<IndexSlice<I, [T]>, Global> where
    I: Idx

impl From<Uid> for u32

impl From<Gid> for u32

impl From<Pid> for i32

impl From<NotNan<f32>> for f32

impl From<NotNan<f64>> for f64

impl<A> From<A> for SmallVec<A> where
    A: Array, 

impl<'a, A> From<&'a [<A as Array>::Item]> for SmallVec<A> where
    A: Array,
    <A as Array>::Item: Clone

impl From<LayoutError> for CollectionAllocErr

impl<A> From<Vec<<A as Array>::Item, Global>> for SmallVec<A> where
    A: Array, 

impl From<ValueReadError> for NumValueReadError

impl From<MarkerReadError> for ValueReadError

impl From<MarkerReadError> for NumValueReadError

impl From<DataWriteError> for ValueWriteError

impl From<u8> for Marker

impl From<MarkerWriteError> for ValueWriteError

impl<'a> From<ValueReadError> for DecodeStringError<'a>

impl From<Error> for MarkerReadError

impl From<Vec<u32, Global>> for IndexVec[src]

impl<X> From<Range<X>> for Uniform<X> where
    X: SampleUniform
[src]

impl<X> From<RangeInclusive<X>> for Uniform<X> where
    X: SampleUniform
[src]

impl From<Vec<usize, Global>> for IndexVec[src]

impl From<NonZeroU32> for Error[src]

impl From<Error> for Error[src]

impl From<NonZeroU32> for Error[src]

impl From<ChaCha20Core> for ChaCha20Rng[src]

impl From<ChaCha12Core> for ChaCha12Rng[src]

impl From<ChaCha8Core> for ChaCha8Rng[src]

impl<S3, S4, NI> From<u128x1_sse2<S3, S4, NI>> for vec128_storage

impl<S3, S4, NI> From<u32x4_sse2<S3, S4, NI>> for vec128_storage

impl<S3, S4, NI> From<u64x2_sse2<S3, S4, NI>> for vec128_storage

impl<NI> From<u32x4x4_avx2<NI>> for vec512_storage

impl<W, G> From<x2<W, G>> for vec256_storage where
    W: Copy,
    vec128_storage: From<W>, 

impl<W> From<x4<W>> for vec512_storage where
    W: Copy,
    vec128_storage: From<W>, 

impl From<Errors> for ParseError[src]

impl From<u8> for Level

pub fn from(number: u8) -> Level

Create level by number

impl<'_, T, A> From<&'_ mut [T]> for TinyVec<A> where
    T: Clone + Default,
    A: Array<Item = T>, 

impl<'_, T, A> From<&'_ [T]> for TinyVec<A> where
    T: Clone + Default,
    A: Array<Item = T>, 

impl<'s, T> From<&'s mut [T]> for SliceVec<'s, T>

pub fn from(data: &'s mut [T]) -> SliceVec<'s, T>

Uses the full slice as the initial length.

Example

let mut arr = [0_i32; 2];
let mut sv = SliceVec::from(&mut arr[..]);

impl<'s, T, A> From<&'s mut A> for SliceVec<'s, T> where
    A: AsMut<[T]>, 

pub fn from(a: &'s mut A) -> SliceVec<'s, T>

Calls AsRef::as_mut then uses the full slice as the initial length.

Example

let mut arr = [0, 0];
let mut sv = SliceVec::from(&mut arr);

impl<A> From<A> for ArrayVec<A> where
    A: Array, 

#[must_use]
pub fn from(data: A) -> ArrayVec<A>

The output has a length equal to the full array.

If you want to select a length, use from_array_len

impl<A> From<A> for TinyVec<A> where
    A: Array, 

impl<A> From<ArrayVec<A>> for TinyVec<A> where
    A: Array, 

impl<'a> From<&'a str> for ErrorKind[src]

impl From<Error> for ErrorKind[src]

impl From<String> for ErrorKind[src]

impl From<ErrorKind> for Error[src]

impl From<String> for Error[src]

impl From<Error> for Error[src]

An error happened while serializing JSON

impl<'a> From<&'a str> for Error[src]

impl From<Error> for ErrorKind[src]

impl From<ErrorKind> for Error[src]

impl From<String> for Error[src]

impl From<ErrorKind> for Error[src]

impl From<Error> for Error[src]

Link to a std::io::Error type.

impl From<Error> for ErrorKind[src]

impl From<String> for ErrorKind[src]

impl<'a> From<&'a str> for ErrorKind[src]

impl From<ErrorKind> for ErrorKind[src]

Link to another ErrorChain.

impl<'a> From<&'a str> for Error[src]

impl<'a> From<&'a str> for Error[src]

impl From<String> for ErrorKind[src]

impl From<String> for Error[src]

impl From<Error> for Error[src]

Link to another ErrorChain.

impl<'a> From<&'a str> for ErrorKind[src]

impl From<Errors> for ParseError[src]

impl From<CharRange> for CharIter

impl From<CharIter> for CharRange

impl From<PersistError> for NamedTempFile[src]

impl From<PathPersistError> for TempPath[src]

impl From<Error> for Error[src]

impl<'a, 'z> From<&'z ArgGroup<'a>> for ArgGroup<'a>[src]

impl From<Error> for Error[src]

impl<'a, 'b, 'z> From<&'z Arg<'a, 'b>> for Arg<'a, 'b>[src]

impl From<Colour> for Style

pub fn from(colour: Colour) -> Style

You can turn a Colour into a Style with the foreground colour set with the From trait.

use ansi_term::{Style, Colour};
let green_foreground = Style::default().fg(Colour::Green);
assert_eq!(green_foreground, Colour::Green.normal());
assert_eq!(green_foreground, Colour::Green.into());
assert_eq!(green_foreground, Style::from(Colour::Green));

impl<'a, I, S> From<I> for ANSIGenericString<'a, S> where
    S: 'a + ToOwned + ?Sized,
    I: Into<Cow<'a, S>>,
    <S as ToOwned>::Owned: Debug

impl From<StaticUser> for &'static str[src]

impl<'_derivative_strum> From<&'_derivative_strum StaticUser> for &'static str[src]

Loading content...

Implementors

impl From<AccountsSaveError> for InternalError[src]

impl From<AccountsSaveError> for MgmtError[src]

impl From<InternalError> for ApiPieceOpError[src]

impl From<InternalError> for OnlineError[src]

impl From<InternalError> for SpecError[src]

impl From<InternalError> for LibraryLoadError[src]

impl From<InternalError> for MgmtError[src]

impl From<OccultationKindAlwaysOk> for OccultationKindGeneral<(OccDisplacement, ZCoord)>[src]

impl From<OnlineError> for ApiPieceOpError[src]

impl From<PieceOpError> for ApiPieceOpError[src]

impl From<PieceUpdateOp<(), ()>> for PieceUpdateOps[src]

impl From<SVGProcessingError> for InternalError[src]

impl From<SVGProcessingError> for SpecError[src]

impl From<SVGProcessingError> for MgmtError[src]

impl From<SpecError> for MgmtError[src]

impl From<ErrorKind> for otter_api_tests::io::Error1.14.0[src]

Intended for use for errors not exposed to the user, where allocating onto the heap (for normal construction via Error::new) is too costly.

pub fn from(kind: ErrorKind) -> Error[src]

Converts an ErrorKind into an Error.

This conversion allocates a new error with a simple representation of error kind.

Examples

use std::io::{Error, ErrorKind};

let not_found = ErrorKind::NotFound;
let error = Error::from(not_found);
assert_eq!("entity not found", format!("{}", error));

impl From<Infallible> for TryFromIntError1.34.0[src]

impl From<Infallible> for TryFromSliceError1.36.0[src]

impl From<Errno> for otter_api_tests::imports::nix::Error

impl From<Errno> for otter_api_tests::io::Error

impl From<Error> for InternalError[src]

impl From<Error> for AccountsSaveError[src]

impl From<Error> for InternalError[src]

impl From<bool> for otter_api_tests::serde_json::Value[src]

pub fn from(f: bool) -> Value[src]

Convert boolean to Value

Examples

use serde_json::Value;

let b = false;
let x: Value = b.into();

impl From<bool> for otter_api_tests::imports::toml::Value[src]

impl From<bool> for AtomicBool1.24.0[src]

pub fn from(b: bool) -> AtomicBool[src]

Converts a bool into an AtomicBool.

Examples

use std::sync::atomic::AtomicBool;
let atomic_bool = AtomicBool::from(true);
assert_eq!(format!("{:?}", atomic_bool), "true")

impl From<f32> for otter_api_tests::serde_json::Value[src]

pub fn from(f: f32) -> Value[src]

Convert 32-bit floating point number to Value

Examples

use serde_json::Value;

let f: f32 = 13.37;
let x: Value = f.into();

impl From<f32> for otter_api_tests::imports::toml::Value[src]

impl From<f64> for otter_api_tests::serde_json::Value[src]

pub fn from(f: f64) -> Value[src]

Convert 64-bit floating point number to Value

Examples

use serde_json::Value;

let f: f64 = 13.37;
let x: Value = f.into();

impl From<f64> for otter_api_tests::imports::toml::Value[src]

impl From<i8> for otter_api_tests::serde_json::Value[src]

impl From<i8> for otter_api_tests::imports::toml::Value[src]

impl From<i8> for Number[src]

impl From<i8> for AtomicI81.34.0[src]

pub fn from(v: i8) -> AtomicI8[src]

Converts an i8 into an AtomicI8.

impl From<i16> for otter_api_tests::serde_json::Value[src]

impl From<i16> for Number[src]

impl From<i16> for AtomicI161.34.0[src]

pub fn from(v: i16) -> AtomicI16[src]

Converts an i16 into an AtomicI16.

impl From<i32> for otter_api_tests::serde_json::Value[src]

impl From<i32> for otter_api_tests::imports::toml::Value[src]

impl From<i32> for Number[src]

impl From<i32> for ClockId

impl From<i32> for AtomicI321.34.0[src]

pub fn from(v: i32) -> AtomicI32[src]

Converts an i32 into an AtomicI32.

impl From<i64> for otter_api_tests::serde_json::Value[src]

impl From<i64> for otter_api_tests::imports::toml::Value[src]

impl From<i64> for Number[src]

impl From<i64> for AtomicI641.34.0[src]

pub fn from(v: i64) -> AtomicI64[src]

Converts an i64 into an AtomicI64.

impl From<isize> for otter_api_tests::serde_json::Value[src]

impl From<isize> for Number[src]

impl From<isize> for AtomicIsize1.23.0[src]

pub fn from(v: isize) -> AtomicIsize[src]

Converts an isize into an AtomicIsize.

impl From<!> for Infallible1.34.0[src]

impl From<!> for TryFromIntError[src]

impl From<(WhatResponseToClientOp, PieceUpdateOp<(), ()>, Vec<LogEntry, Global>)> for PieceUpdate[src]

impl From<(Box<Item, Global>, Option<(OccultIlkName, Arc<dyn OccultedPieceTrait + 'static>)>)> for PieceSpecLoaded[src]

impl From<u8> for otter_api_tests::serde_json::Value[src]

impl From<u8> for otter_api_tests::imports::toml::Value[src]

impl From<u8> for Number[src]

impl From<u8> for FaceId[src]

impl From<u8> for AtomicU81.34.0[src]

pub fn from(v: u8) -> AtomicU8[src]

Converts an u8 into an AtomicU8.

impl From<u16> for otter_api_tests::serde_json::Value[src]

impl From<u16> for Number[src]

impl From<u16> for AtomicU161.34.0[src]

pub fn from(v: u16) -> AtomicU16[src]

Converts an u16 into an AtomicU16.

impl From<u32> for otter_api_tests::serde_json::Value[src]

impl From<u32> for otter_api_tests::imports::toml::Value[src]

impl From<u32> for Number[src]

impl From<u32> for AtomicU321.34.0[src]

pub fn from(v: u32) -> AtomicU32[src]

Converts an u32 into an AtomicU32.

impl From<u64> for otter_api_tests::serde_json::Value[src]

impl From<u64> for Number[src]

impl From<u64> for LimbVal

impl From<u64> for AtomicU641.34.0[src]

pub fn from(v: u64) -> AtomicU64[src]

Converts an u64 into an AtomicU64.

impl From<()> for otter_api_tests::serde_json::Value[src]

pub fn from(()) -> Value[src]

Convert () to Value

Examples

use serde_json::Value;

let u = ();
let x: Value = u.into();

impl From<usize> for otter_api_tests::serde_json::Value[src]

impl From<usize> for Number[src]

impl From<usize> for DescId[src]

impl From<usize> for SvgId[src]

impl From<usize> for FaceId[src]

impl From<usize> for Notch[src]

impl From<usize> for AtomicUsize1.23.0[src]

pub fn from(v: usize) -> AtomicUsize[src]

Converts an usize into an AtomicUsize.

impl From<Error> for InternalError[src]

impl From<Error> for SVGProcessingError[src]

impl From<Error> for AccountsSaveError[src]

impl From<Error> for MgmtChannelReadError[src]

impl From<Error> for FlexiLoggerError

impl From<RecvError> for RecvTimeoutError1.24.0[src]

pub fn from(err: RecvError) -> RecvTimeoutError[src]

Converts a RecvError into a RecvTimeoutError.

This conversion always returns RecvTimeoutError::Disconnected.

No data is allocated on the heap.

impl From<RecvError> for TryRecvError1.24.0[src]

pub fn from(err: RecvError) -> TryRecvError[src]

Converts a RecvError into a TryRecvError.

This conversion always returns TryRecvError::Disconnected.

No data is allocated on the heap.

impl From<Error> for otter_api_tests::io::Error[src]

pub fn from(j: Error) -> Error[src]

Convert a serde_json::Error into an io::Error.

JSON syntax and data errors are turned into InvalidData IO errors. EOF errors are turned into UnexpectedEof IO errors.

use std::io;

enum MyError {
    Io(io::Error),
    Json(serde_json::Error),
}

impl From<serde_json::Error> for MyError {
    fn from(err: serde_json::Error) -> MyError {
        use serde_json::error::Category;
        match err.classify() {
            Category::Io => {
                MyError::Io(err.into())
            }
            Category::Syntax | Category::Data | Category::Eof => {
                MyError::Json(err)
            }
        }
    }
}

impl From<Map<String, Value>> for otter_api_tests::serde_json::Value[src]

pub fn from(f: Map<String, Value>) -> Value[src]

Convert map (with string keys) to Value

Examples

use serde_json::{Map, Value};

let mut m = Map::new();
m.insert("Lorem".to_string(), "ipsum".into());
let x: Value = m.into();

impl From<Number> for otter_api_tests::serde_json::Value[src]

pub fn from(f: Number) -> Value[src]

Convert Number to Value

Examples

use serde_json::{Number, Value};

let n = Number::from(7);
let x: Value = n.into();

impl From<CoordinateOverflow> for InternalError[src]

impl From<CoordinateOverflow> for MgmtError[src]

impl From<Duration> for TimeSpec

impl From<File> for Stdio1.20.0[src]

pub fn from(file: File) -> Stdio[src]

Converts a File into a Stdio

Examples

File will be converted to Stdio using Stdio::from under the hood.

use std::fs::File;
use std::process::Command;

// With the `foo.txt` file containing `Hello, world!"
let file = File::open("foo.txt").unwrap();

let reverse = Command::new("rev")
    .stdin(file)  // Implicit File conversion into a Stdio
    .output()
    .expect("failed reverse command");

assert_eq!(reverse.stdout, b"!dlrow ,olleH");

impl From<PathBuf> for Arc<Path>1.24.0[src]

pub fn from(s: PathBuf) -> Arc<Path>[src]

Converts a PathBuf into an Arc by moving the PathBuf data into a new Arc buffer.

impl From<TimeSpec> for otter_api_tests::shapelib::Duration

impl From<TryFromIntError> for Overflow

impl From<Utf8Error> for otter_api_tests::imports::rmp_serde::decode::Error

impl From<AccountNotFound> for MgmtError[src]

impl From<CircleShape> for Outline[src]

impl From<ClientId> for KeyData[src]

impl From<GameBeingDestroyed> for OnlineError[src]

impl From<GameBeingDestroyed> for MgmtError[src]

impl From<HtmlLit> for &'static HtmlStr

impl From<HtmlLit> for Html

impl From<OccId> for KeyData[src]

impl From<PlayerId> for KeyData[src]

impl From<PlayerNotFound> for ApiPieceOpError[src]

impl From<PlayerNotFound> for OnlineError[src]

impl From<PlayerNotFound> for MgmtError[src]

impl From<RectShape> for Outline[src]

impl From<TokenDeliveryError> for MgmtError[src]

impl From<UnsupportedColourSpec> for SpecError[src]

impl From<UnsupportedColourSpec> for LibraryLoadError[src]

impl From<VisiblePieceId> for KeyData[src]

impl From<SystemTime> for DateTime<Local>[src]

impl From<SystemTime> for DateTime<Utc>[src]

impl From<Overflow> for InternalError[src]

impl From<Overflow> for MgmtError[src]

impl From<RangeBackwards> for LogicError

impl From<TotallyUnboundedRange> for LogicError

impl From<Error> for InternalError[src]

impl From<Error> for AuthorisationError[src]

impl From<Error> for TokenDeliveryError[src]

impl From<DateTime<FixedOffset>> for DateTime<Local>[src]

Convert a DateTime<FixedOffset> instance into a DateTime<Local> instance.

pub fn from(src: DateTime<FixedOffset>) -> DateTime<Local>[src]

Convert this DateTime<FixedOffset> instance into a DateTime<Local> instance.

Conversion is performed via DateTime::with_timezone. Returns the equivalent value in local time.

impl From<DateTime<FixedOffset>> for DateTime<Utc>[src]

Convert a DateTime<FixedOffset> instance into a DateTime<Utc> instance.

pub fn from(src: DateTime<FixedOffset>) -> DateTime<Utc>[src]

Convert this DateTime<FixedOffset> instance into a DateTime<Utc> instance.

Conversion is performed via DateTime::with_timezone, accounting for the timezone difference.

impl From<DateTime<Local>> for DateTime<FixedOffset>[src]

Convert a DateTime<Local> instance into a DateTime<FixedOffset> instance.

pub fn from(src: DateTime<Local>) -> DateTime<FixedOffset>[src]

Convert this DateTime<Local> instance into a DateTime<FixedOffset> instance.

Conversion is performed via DateTime::with_timezone. Note that the converted value returned by this will be created with a fixed timezone offset of 0.

impl From<DateTime<Local>> for DateTime<Utc>[src]

Convert a DateTime<Local> instance into a DateTime<Utc> instance.

pub fn from(src: DateTime<Local>) -> DateTime<Utc>[src]

Convert this DateTime<Local> instance into a DateTime<Utc> instance.

Conversion is performed via DateTime::with_timezone, accounting for the difference in timezones.

impl From<DateTime<Utc>> for DateTime<FixedOffset>[src]

Convert a DateTime<Utc> instance into a DateTime<FixedOffset> instance.

pub fn from(src: DateTime<Utc>) -> DateTime<FixedOffset>[src]

Convert this DateTime<Utc> instance into a DateTime<FixedOffset> instance.

Conversion is done via DateTime::with_timezone. Note that the converted value returned by this will be created with a fixed timezone offset of 0.

impl From<DateTime<Utc>> for DateTime<Local>[src]

Convert a DateTime<Utc> instance into a DateTime<Local> instance.

pub fn from(src: DateTime<Utc>) -> DateTime<Local>[src]

Convert this DateTime<Utc> instance into a DateTime<Local> instance.

Conversion is performed via DateTime::with_timezone, accounting for the difference in timezones.

impl From<GlobError> for LibraryLoadError[src]

impl From<termios> for Termios

impl From<timespec> for TimeSpec

impl From<timeval> for TimeVal

impl From<ucred> for UnixCredentials

impl From<SetLoggerError> for FlexiLoggerError

impl From<Termios> for termios

impl From<NotNan<f32>> for NotNan<f64>

impl From<KeyData> for AccountId[src]

impl From<KeyData> for ClientId[src]

impl From<KeyData> for OccId[src]

impl From<KeyData> for OccultIlkId[src]

impl From<KeyData> for PieceId[src]

impl From<KeyData> for PlayerId[src]

impl From<KeyData> for VisiblePieceId[src]

impl From<KeyData> for DefaultKey[src]

impl From<Error> for FlexiLoggerError

impl From<Error> for LibraryLoadError[src]

impl From<Error> for otter_api_tests::io::Error[src]

impl From<Datetime> for otter_api_tests::imports::toml::Value[src]

impl From<Map<String, Value>> for otter_api_tests::imports::toml::Value[src]

impl From<NonZeroI8> for NonZeroI161.41.0[src]

Converts NonZeroI8 to NonZeroI16 losslessly.

impl From<NonZeroI8> for NonZeroI321.41.0[src]

Converts NonZeroI8 to NonZeroI32 losslessly.

impl From<NonZeroI8> for NonZeroI641.41.0[src]

Converts NonZeroI8 to NonZeroI64 losslessly.

impl From<NonZeroI8> for NonZeroI1281.41.0[src]

Converts NonZeroI8 to NonZeroI128 losslessly.

impl From<NonZeroI8> for NonZeroIsize1.41.0[src]

Converts NonZeroI8 to NonZeroIsize losslessly.

impl From<NonZeroI16> for NonZeroI321.41.0[src]

Converts NonZeroI16 to NonZeroI32 losslessly.

impl From<NonZeroI16> for NonZeroI641.41.0[src]

Converts NonZeroI16 to NonZeroI64 losslessly.

impl From<NonZeroI16> for NonZeroI1281.41.0[src]

Converts NonZeroI16 to NonZeroI128 losslessly.

impl From<NonZeroI16> for NonZeroIsize1.41.0[src]

Converts NonZeroI16 to NonZeroIsize losslessly.

impl From<NonZeroI32> for NonZeroI641.41.0[src]

Converts NonZeroI32 to NonZeroI64 losslessly.

impl From<NonZeroI32> for NonZeroI1281.41.0[src]

Converts NonZeroI32 to NonZeroI128 losslessly.

impl From<NonZeroI64> for NonZeroI1281.41.0[src]

Converts NonZeroI64 to NonZeroI128 losslessly.

impl From<NonZeroU8> for NonZeroUsize1.41.0[src]

Converts NonZeroU8 to NonZeroUsize losslessly.

impl From<NonZeroU8> for NonZeroI161.41.0[src]

Converts NonZeroU8 to NonZeroI16 losslessly.

impl From<NonZeroU8> for NonZeroI321.41.0[src]

Converts NonZeroU8 to NonZeroI32 losslessly.

impl From<NonZeroU8> for NonZeroI641.41.0[src]

Converts NonZeroU8 to NonZeroI64 losslessly.

impl From<NonZeroU8> for NonZeroI1281.41.0[src]

Converts NonZeroU8 to NonZeroI128 losslessly.

impl From<NonZeroU8> for NonZeroIsize1.41.0[src]

Converts NonZeroU8 to NonZeroIsize losslessly.

impl From<NonZeroU8> for NonZeroU161.41.0[src]

Converts NonZeroU8 to NonZeroU16 losslessly.

impl From<NonZeroU8> for NonZeroU321.41.0[src]

Converts NonZeroU8 to NonZeroU32 losslessly.

impl From<NonZeroU8> for NonZeroU641.41.0[src]

Converts NonZeroU8 to NonZeroU64 losslessly.

impl From<NonZeroU8> for NonZeroU1281.41.0[src]

Converts NonZeroU8 to NonZeroU128 losslessly.

impl From<NonZeroU16> for NonZeroUsize1.41.0[src]

Converts NonZeroU16 to NonZeroUsize losslessly.

impl From<NonZeroU16> for NonZeroI321.41.0[src]

Converts NonZeroU16 to NonZeroI32 losslessly.

impl From<NonZeroU16> for NonZeroI641.41.0[src]

Converts NonZeroU16 to NonZeroI64 losslessly.

impl From<NonZeroU16> for NonZeroI1281.41.0[src]

Converts NonZeroU16 to NonZeroI128 losslessly.

impl From<NonZeroU16> for NonZeroU321.41.0[src]

Converts NonZeroU16 to NonZeroU32 losslessly.

impl From<NonZeroU16> for NonZeroU641.41.0[src]

Converts NonZeroU16 to NonZeroU64 losslessly.

impl From<NonZeroU16> for NonZeroU1281.41.0[src]

Converts NonZeroU16 to NonZeroU128 losslessly.

impl From<NonZeroU32> for NonZeroI641.41.0[src]

Converts NonZeroU32 to NonZeroI64 losslessly.

impl From<NonZeroU32> for NonZeroI1281.41.0[src]

Converts NonZeroU32 to NonZeroI128 losslessly.

impl From<NonZeroU32> for NonZeroU641.41.0[src]

Converts NonZeroU32 to NonZeroU64 losslessly.

impl From<NonZeroU32> for NonZeroU1281.41.0[src]

Converts NonZeroU32 to NonZeroU128 losslessly.

impl From<NonZeroU64> for NonZeroI1281.41.0[src]

Converts NonZeroU64 to NonZeroI128 losslessly.

impl From<NonZeroU64> for NonZeroU1281.41.0[src]

Converts NonZeroU64 to NonZeroU128 losslessly.

impl From<ParseFloatError> for SVGProcessingError[src]

impl From<ParseIntError> for FlexiLoggerError

impl From<Box<Path, Global>> for PathBuf1.18.0[src]

pub fn from(boxed: Box<Path, Global>) -> PathBuf[src]

Converts a Box<Path> into a PathBuf

This conversion does not allocate or copy memory.

impl From<FromUtf8Error> for otter_api_tests::imports::nix::Error

impl From<String> for otter_api_tests::serde_json::Value[src]

pub fn from(f: String) -> Value[src]

Convert String to Value

Examples

use serde_json::Value;

let s: String = "lorem".to_string();
let x: Value = s.into();

impl From<String> for otter_api_tests::imports::toml::Value[src]

impl From<String> for Arc<str>1.21.0[src]

pub fn from(v: String) -> Arc<str>[src]

Allocate a reference-counted str and copy v into it.

Example

let unique: String = "eggplant".to_owned();
let shared: Arc<str> = Arc::from(unique);
assert_eq!("eggplant", &shared[..]);

impl From<String> for PathBuf[src]

pub fn from(s: String) -> PathBuf[src]

Converts a String into a PathBuf

This conversion does not allocate or copy memory.

impl From<CString> for Arc<CStr>1.24.0[src]

pub fn from(s: CString) -> Arc<CStr>[src]

Converts a CString into a Arc<CStr> without copying or allocating.

impl From<NulError> for otter_api_tests::io::Error[src]

pub fn from(NulError) -> Error[src]

Converts a NulError into a io::Error.

impl From<OsString> for Arc<OsStr>1.24.0[src]

pub fn from(s: OsString) -> Arc<OsStr>[src]

Converts a OsString into a Arc<OsStr> without copying or allocating.

impl From<OsString> for PathBuf[src]

pub fn from(s: OsString) -> PathBuf[src]

Converts an OsString into a PathBuf

This conversion does not allocate or copy memory.

impl From<ChildStderr> for Stdio1.20.0[src]

pub fn from(child: ChildStderr) -> Stdio[src]

Converts a ChildStderr into a Stdio

Examples

use std::process::{Command, Stdio};

let reverse = Command::new("rev")
    .arg("non_existing_file.txt")
    .stderr(Stdio::piped())
    .spawn()
    .expect("failed reverse command");

let cat = Command::new("cat")
    .arg("-")
    .stdin(reverse.stderr.unwrap()) // Converted into a Stdio here
    .output()
    .expect("failed echo command");

assert_eq!(
    String::from_utf8_lossy(&cat.stdout),
    "rev: cannot open non_existing_file.txt: No such file or directory\n"
);

impl From<ChildStdin> for Stdio1.20.0[src]

pub fn from(child: ChildStdin) -> Stdio[src]

Converts a ChildStdin into a Stdio

Examples

ChildStdin will be converted to Stdio using Stdio::from under the hood.

use std::process::{Command, Stdio};

let reverse = Command::new("rev")
    .stdin(Stdio::piped())
    .spawn()
    .expect("failed reverse command");

let _echo = Command::new("echo")
    .arg("Hello, world!")
    .stdout(reverse.stdin.unwrap()) // Converted into a Stdio here
    .output()
    .expect("failed echo command");

// "!dlrow ,olleH" echoed to console

impl From<ChildStdout> for Stdio1.20.0[src]

pub fn from(child: ChildStdout) -> Stdio[src]

Converts a ChildStdout into a Stdio

Examples

ChildStdout will be converted to Stdio using Stdio::from under the hood.

use std::process::{Command, Stdio};

let hello = Command::new("echo")
    .arg("Hello, world!")
    .stdout(Stdio::piped())
    .spawn()
    .expect("failed echo command");

let reverse = Command::new("rev")
    .stdin(hello.stdout.unwrap())  // Converted into a Stdio here
    .output()
    .expect("failed reverse command");

assert_eq!(reverse.stdout, b"!dlrow ,olleH\n");

impl From<Error> for otter_api_tests::io::Error[src]

impl From<PathPersistError> for otter_api_tests::io::Error[src]

impl From<PersistError> for otter_api_tests::io::Error[src]

impl From<Error> for otter_api_tests::io::Error[src]

impl From<DataWriteError> for otter_api_tests::io::Error

impl From<Error> for FlexiLoggerError

impl From<Error> for otter_api_tests::io::Error

pub fn from(walk_err: Error) -> Error

Convert the Error to an io::Error, preserving the original Error as the “inner error”. Note that this also makes the display of the error include the context.

This is different from into_io_error which returns the original io::Error.

impl From<Error> for otter_api_tests::io::Error

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

impl From<MarkerReadError> for otter_api_tests::imports::rmp_serde::decode::Error

impl From<MarkerWriteError> for otter_api_tests::io::Error

impl From<NumValueReadError> for otter_api_tests::imports::rmp_serde::decode::Error

impl From<ParserNumber> for Number[src]

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

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

impl From<TimerSpec> for Expiration

impl From<ValueReadError> for otter_api_tests::imports::rmp_serde::decode::Error

impl From<ValueWriteError> for otter_api_tests::imports::rmp_serde::encode::Error

impl From<ValueWriteError> for otter_api_tests::io::Error

impl<'_> From<&'_ str> for Arc<str>1.21.0[src]

pub fn from(v: &str) -> Arc<str>[src]

Allocate a reference-counted str and copy v into it.

Example

let shared: Arc<str> = Arc::from("eggplant");
assert_eq!("eggplant", &shared[..]);

impl<'_> From<&'_ OsStr> for Arc<OsStr>1.24.0[src]

impl<'_> From<&'_ HtmlStr> for Html

impl<'_> From<&'_ LinksTable> for Html[src]

impl<'_> From<&'_ group> for Group

impl<'_> From<&'_ passwd> for User

impl<'_> From<&'_ CStr> for Arc<CStr>1.24.0[src]

impl<'_> From<&'_ Path> for Arc<Path>1.24.0[src]

pub fn from(s: &Path) -> Arc<Path>[src]

Converts a Path into an Arc by copying the Path data into a new Arc buffer.

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

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

impl<'_, T> From<&'_ T> for PathBuf where
    T: AsRef<OsStr> + ?Sized
[src]

impl<'_, T> From<&'_ T> for NonNull<T> where
    T: ?Sized
1.25.0[src]

impl<'_, T> From<&'_ mut T> for NonNull<T> where
    T: ?Sized
1.25.0[src]

impl<'_, T> From<&'_ [T]> for Arc<[T]> where
    T: Clone
1.21.0[src]

pub fn from(v: &[T]) -> Arc<[T]>[src]

Allocate a reference-counted slice and fill it by cloning v’s items.

Example

let original: &[i32] = &[1, 2, 3];
let shared: Arc<[i32]> = Arc::from(original);
assert_eq!(&[1, 2, 3], &shared[..]);

impl<'a> From<&'a str> for otter_api_tests::serde_json::Value[src]

pub fn from(f: &str) -> Value[src]

Convert string slice to Value

Examples

use serde_json::Value;

let s: &str = "lorem";
let x: Value = s.into();

impl<'a> From<&'a str> for Cow<'a, str>[src]

pub fn from(s: &'a str) -> Cow<'a, str>[src]

Converts a string slice into a Borrowed variant. No heap allocation is performed, and the string is not copied.

Example

assert_eq!(Cow::from("eggplant"), Cow::Borrowed("eggplant"));

impl<'a> From<&'a str> for otter_api_tests::imports::toml::Value[src]

impl<'a> From<&'a OsStr> for Cow<'a, OsStr>1.28.0[src]

impl<'a> From<&'a PathBuf> for Cow<'a, Path>1.28.0[src]

impl<'a> From<&'a sigevent> for SigEvent

impl<'a> From<&'a UnixSocketAddr> for AddrName<'a>

impl<'a> From<&'a String> for Cow<'a, str>1.28.0[src]

pub fn from(s: &'a String) -> Cow<'a, str>[src]

Converts a String reference into a Borrowed variant. No heap allocation is performed, and the string is not copied.

Example

let s = "eggplant".to_string();
assert_eq!(Cow::from(&s), Cow::Borrowed("eggplant"));

impl<'a> From<&'a CStr> for Cow<'a, CStr>1.28.0[src]

impl<'a> From<&'a CString> for Cow<'a, CStr>1.28.0[src]

impl<'a> From<&'a OsString> for Cow<'a, OsStr>1.28.0[src]

impl<'a> From<&'a Path> for Cow<'a, Path>1.6.0[src]

impl<'a> From<Cow<'a, str>> for otter_api_tests::serde_json::Value[src]

pub fn from(f: Cow<'a, str>) -> Value[src]

Convert copy-on-write string to Value

Examples

use serde_json::Value;
use std::borrow::Cow;

let s: Cow<str> = Cow::Borrowed("lorem");
let x: Value = s.into();
use serde_json::Value;
use std::borrow::Cow;

let s: Cow<str> = Cow::Owned("lorem".to_string());
let x: Value = s.into();

impl<'a> From<Cow<'a, Path>> for PathBuf1.28.0[src]

impl<'a> From<PathBuf> for Cow<'a, Path>1.6.0[src]

impl<'a> From<String> for Cow<'a, str>[src]

pub fn from(s: String) -> Cow<'a, str>[src]

Converts a String into an Owned variant. No heap allocation is performed, and the string is not copied.

Example

let s = "eggplant".to_string();
let s2 = "eggplant".to_string();
assert_eq!(Cow::from(s), Cow::<'static, str>::Owned(s2));

impl<'a> From<Vec<AioCb<'a>, Global>> for LioCb<'a>

impl<'a> From<CString> for Cow<'a, CStr>1.28.0[src]

impl<'a> From<OsString> for Cow<'a, OsStr>1.28.0[src]

impl<'a> From<DecodeStringError<'a>> for otter_api_tests::imports::rmp_serde::decode::Error

impl<'a> From<PercentDecode<'a>> for Cow<'a, [u8]>

impl<'a> From<PercentDecode<'a>> for Cow<'a, [u8]>

impl<'a> From<PercentEncode<'a>> for Cow<'a, str>

impl<'a, B> From<Cow<'a, B>> for Arc<B> where
    B: ToOwned + ?Sized,
    Arc<B>: From<&'a B>,
    Arc<B>: From<<B as ToOwned>::Owned>, 
1.45.0[src]

impl<'a, E> From<PercentEncode<'a, E>> for Cow<'a, str> where
    E: EncodeSet, 

impl<'a, I, T> From<&'a IndexSlice<I, [T]>> for otter_api_tests::shapelib::IndexVec<I, T> where
    T: Clone,
    I: Idx

impl<'a, I, T> From<&'a mut IndexSlice<I, [T]>> for otter_api_tests::shapelib::IndexVec<I, T> where
    T: Clone,
    I: Idx

impl<'a, I, T> From<Cow<'a, IndexSlice<I, [T]>>> for otter_api_tests::shapelib::IndexVec<I, T> where
    I: Idx,
    IndexSlice<I, [T]>: ToOwned,
    <IndexSlice<I, [T]> as ToOwned>::Owned == IndexVec<I, T>, 

impl<'a, I, T> From<&'a [T]> for &'a IndexSlice<I, [T]> where
    I: Idx

impl<'a, I, T> From<&'a mut [T]> for &'a mut IndexSlice<I, [T]> where
    I: Idx

impl<'a, T> From<&'a Option<T>> for Option<&'a T>1.30.0[src]

pub fn from(o: &'a Option<T>) -> Option<&'a T>[src]

Converts from &Option<T> to Option<&T>.

Examples

Converts an Option<String> into an Option<usize>, preserving the original. The map method takes the self argument by value, consuming the original, so this technique uses as_ref to first take an Option to a reference to the value inside the original.

let s: Option<String> = Some(String::from("Hello, Rustaceans!"));
let o: Option<usize> = Option::from(&s).map(|ss: &String| ss.len());

println!("Can still print s: {:?}", s);

assert_eq!(o, Some(18));

impl<'a, T> From<&'a Vec<T, Global>> for Cow<'a, [T]> where
    T: Clone
1.28.0[src]

impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T>1.30.0[src]

pub fn from(o: &'a mut Option<T>) -> Option<&'a mut T>[src]

Converts from &mut Option<T> to Option<&mut T>

Examples

let mut s = Some(String::from("Hello"));
let o: Option<&mut String> = Option::from(&mut s);

match o {
    Some(t) => *t = String::from("Hello, Rustaceans!"),
    None => (),
}

assert_eq!(s, Some(String::from("Hello, Rustaceans!")));

impl<'a, T> From<&'a T> for &'a OrderedFloat<T> where
    T: Float

impl<'a, T> From<&'a mut T> for &'a mut OrderedFloat<T> where
    T: Float

impl<'a, T> From<&'a [T]> for otter_api_tests::serde_json::Value where
    T: Clone + Into<Value>, 
[src]

pub fn from(f: &'a [T]) -> Value[src]

Convert a slice to Value

Examples

use serde_json::Value;

let v: &[&str] = &["lorem", "ipsum", "dolor"];
let x: Value = v.into();

impl<'a, T> From<&'a [T]> for Cow<'a, [T]> where
    T: Clone
1.8.0[src]

impl<'a, T> From<Vec<T, Global>> for Cow<'a, [T]> where
    T: Clone
1.8.0[src]

impl<'a, T> From<T> for Env<'a> where
    T: Into<Cow<'a, str>>, 

impl<'i, P, II, I> From<I> for PermSet<P> where
    I: IntoIterator<Item = II>,
    P: Perm,
    II: Borrow<P>, 
[src]

impl<'i, T: AsRef<str> + 'i, U: AsRef<str> + 'i, L: IntoIterator<Item = &'i (T, U)>> From<L> for Subst[src]

impl<'t> From<Match<'t>> for Range<usize>

impl<'t> From<Match<'t>> for Range<usize>

impl<A> From<(A,)> for Zip<(<A as IntoIterator>::IntoIter,)> where
    A: IntoIterator
[src]

impl<A> From<A> for otter_api_tests::shapelib::ArrayVec<A> where
    A: Array
[src]

Create an ArrayVec from an array.

use arrayvec::ArrayVec;

let mut array = ArrayVec::from([1, 2, 3]);
assert_eq!(array.len(), 3);
assert_eq!(array.capacity(), 3);

impl<A, B> From<(A, B)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter)> where
    B: IntoIterator,
    A: IntoIterator
[src]

impl<A, B, C> From<(A, B, C)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    A: IntoIterator
[src]

impl<A, B, C, D> From<(A, B, C, D)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    A: IntoIterator,
    D: IntoIterator
[src]

impl<A, B, C, D, E> From<(A, B, C, D, E)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    D: IntoIterator
[src]

impl<A, B, C, D, E, F> From<(A, B, C, D, E, F)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter, <F as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    F: IntoIterator,
    D: IntoIterator
[src]

impl<A, B, C, D, E, F, G> From<(A, B, C, D, E, F, G)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter, <F as IntoIterator>::IntoIter, <G as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    F: IntoIterator,
    G: IntoIterator,
    D: IntoIterator
[src]

impl<A, B, C, D, E, F, G, H> From<(A, B, C, D, E, F, G, H)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter, <F as IntoIterator>::IntoIter, <G as IntoIterator>::IntoIter, <H as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    F: IntoIterator,
    G: IntoIterator,
    D: IntoIterator,
    H: IntoIterator
[src]

impl<A, B, C, D, E, F, G, H, I> From<(A, B, C, D, E, F, G, H, I)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter, <F as IntoIterator>::IntoIter, <G as IntoIterator>::IntoIter, <H as IntoIterator>::IntoIter, <I as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    I: IntoIterator,
    F: IntoIterator,
    G: IntoIterator,
    D: IntoIterator,
    H: IntoIterator
[src]

impl<A, B, C, D, E, F, G, H, I, J> From<(A, B, C, D, E, F, G, H, I, J)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter, <F as IntoIterator>::IntoIter, <G as IntoIterator>::IntoIter, <H as IntoIterator>::IntoIter, <I as IntoIterator>::IntoIter, <J as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    I: IntoIterator,
    F: IntoIterator,
    G: IntoIterator,
    D: IntoIterator,
    H: IntoIterator,
    J: IntoIterator
[src]

impl<A, B, C, D, E, F, G, H, I, J, K> From<(A, B, C, D, E, F, G, H, I, J, K)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter, <F as IntoIterator>::IntoIter, <G as IntoIterator>::IntoIter, <H as IntoIterator>::IntoIter, <I as IntoIterator>::IntoIter, <J as IntoIterator>::IntoIter, <K as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    K: IntoIterator,
    I: IntoIterator,
    F: IntoIterator,
    G: IntoIterator,
    D: IntoIterator,
    H: IntoIterator,
    J: IntoIterator
[src]

impl<A, B, C, D, E, F, G, H, I, J, K, L> From<(A, B, C, D, E, F, G, H, I, J, K, L)> for Zip<(<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter, <C as IntoIterator>::IntoIter, <D as IntoIterator>::IntoIter, <E as IntoIterator>::IntoIter, <F as IntoIterator>::IntoIter, <G as IntoIterator>::IntoIter, <H as IntoIterator>::IntoIter, <I as IntoIterator>::IntoIter, <J as IntoIterator>::IntoIter, <K as IntoIterator>::IntoIter, <L as IntoIterator>::IntoIter)> where
    C: IntoIterator,
    L: IntoIterator,
    B: IntoIterator,
    E: IntoIterator,
    A: IntoIterator,
    K: IntoIterator,
    I: IntoIterator,
    F: IntoIterator,
    G: IntoIterator,
    D: IntoIterator,
    H: IntoIterator,
    J: IntoIterator
[src]

impl<D> From<D> for Context<D> where
    D: Display + Send + Sync + 'static, 

impl<E> From<E> for Loop<E>[src]

impl<E> From<E> for otter_api_tests::imports::anyhow::Error where
    E: Error + Send + Sync + 'static, 
[src]

impl<F> From<F> for otter_api_tests::imports::failure::Error where
    F: Fail

impl<I, T> From<Box<IndexSlice<I, [T]>, Global>> for otter_api_tests::shapelib::IndexVec<I, T> where
    I: Idx

impl<I, T> From<Vec<T, Global>> for otter_api_tests::shapelib::IndexVec<I, T> where
    I: Idx

impl<L, R> From<Result<R, L>> for Either<L, R>[src]

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

impl<P> From<LoadedAcl<P>> for Acl<P> where
    P: Perm
[src]

impl<P> From<Acl<P>> for LoadedAcl<P> where
    P: Perm
[src]

impl<R, G, T> From<T> for ReentrantMutex<R, G, T> where
    R: RawMutex,
    G: GetThreadId

impl<R, T> From<T> for otter_api_tests::imports::parking_lot::lock_api::Mutex<R, T> where
    R: RawMutex

impl<R, T> From<T> for otter_api_tests::imports::parking_lot::lock_api::RwLock<R, T> where
    R: RawRwLock

impl<S, V> From<BTreeMap<S, V>> for otter_api_tests::imports::toml::Value where
    S: Into<String>,
    V: Into<Value>, 
[src]

impl<S, V> From<HashMap<S, V, RandomState>> for otter_api_tests::imports::toml::Value where
    S: Into<String> + Hash + Eq,
    V: Into<Value>, 
[src]

impl<T> From<[T; 2]> for OldNew<T>[src]

impl<T> From<!> for T1.34.0[src]

Stability note: This impl does not yet exist, but we are “reserving space” to add it in the future. See rust-lang/rust#64715 for details.

impl<T> From<*mut T> for AtomicPtr<T>1.23.0[src]

impl<T> From<SendError<T>> for otter_api_tests::mpsc::TrySendError<T>1.24.0[src]

pub fn from(err: SendError<T>) -> TrySendError<T>[src]

Converts a SendError<T> into a TrySendError<T>.

This conversion always returns a TrySendError::Disconnected containing the data in the SendError<T>.

No data is allocated on the heap.

impl<T> From<Authorisation<Global>> for Authorisation<T> where
    T: Serialize
[src]

impl<T> From<Box<T, Global>> for Arc<T> where
    T: ?Sized
1.21.0[src]

pub fn from(v: Box<T, Global>) -> Arc<T>[src]

Move a boxed object to a new, reference-counted allocation.

Example

let unique: Box<str> = Box::from("eggplant");
let shared: Arc<str> = Arc::from(unique);
assert_eq!("eggplant", &shared[..]);

impl<T> From<Vec<T, Global>> for otter_api_tests::serde_json::Value where
    T: Into<Value>, 
[src]

pub fn from(f: Vec<T, Global>) -> Value[src]

Convert a Vec to Value

Examples

use serde_json::Value;

let v = vec!["lorem", "ipsum", "dolor"];
let x: Value = v.into();

impl<T> From<Vec<T, Global>> for Arc<[T]>1.21.0[src]

pub fn from(v: Vec<T, Global>) -> Arc<[T]>[src]

Allocate a reference-counted slice and move v’s items into it.

Example

let unique: Vec<i32> = vec![1, 2, 3];
let shared: Arc<[i32]> = Arc::from(unique);
assert_eq!(&[1, 2, 3], &shared[..]);

impl<T> From<Vec<T, Global>> for VecDeque<T>1.10.0[src]

pub fn from(other: Vec<T, Global>) -> VecDeque<T>[src]

Turn a Vec<T> into a VecDeque<T>.

This avoids reallocating where possible, but the conditions for that are strict, and subject to change, and so shouldn’t be relied upon unless the Vec<T> came from From<VecDeque<T>> and hasn’t been reallocated.

impl<T> From<T> for Option<T>1.12.0[src]

pub fn from(val: T) -> Option<T>[src]

Copies val into a new Some.

Examples

let o: Option<u8> = Option::from(67);

assert_eq!(Some(67), o);

impl<T> From<T> for Poll<T>1.36.0[src]

pub fn from(t: T) -> Poll<T>[src]

Convert to a Ready variant.

Example

assert_eq!(Poll::from(true), Poll::Ready(true));

impl<T> From<T> for Arc<T>1.6.0[src]

impl<T> From<T> for OrderedFloat<T> where
    T: Float

impl<T> From<T> for RefCell<T>1.12.0[src]

impl<T> From<T> for otter_api_tests::imports::once_cell::sync::OnceCell<T>

impl<T> From<T> for otter_api_tests::imports::once_cell::unsync::OnceCell<T>

impl<T> From<T> for Cell<T>1.12.0[src]

impl<T> From<T> for UnsafeCell<T>1.12.0[src]

impl<T> From<T> for otter_api_tests::imports::failure::_core::lazy::OnceCell<T>[src]

impl<T> From<T> for T[src]

impl<T> From<Unique<T>> for NonNull<T> where
    T: ?Sized
[src]

impl<T, A> From<Box<T, A>> for Pin<Box<T, A>> where
    T: ?Sized,
    A: Allocator + 'static, 
1.33.0[src]

pub fn from(boxed: Box<T, A>) -> Pin<Box<T, A>>

Notable traits for Pin<P>

impl<P> Future for Pin<P> where
    P: Unpin + DerefMut,
    <P as Deref>::Target: Future
type Output = <<P as Deref>::Target as Future>::Output;
[src]

Converts a Box<T> into a Pin<Box<T>>

This conversion does not allocate on the heap and happens in place.

impl<T, A> From<T> for Unauthorised<T, A>[src]

impl<Tz> From<DateTime<Tz>> for SystemTime where
    Tz: TimeZone
[src]

impl<V> From<Vec<V, Global>> for otter_api_tests::imports::toml::Value where
    V: Into<Value>, 
[src]

impl<W> From<IntoInnerError<W>> for otter_api_tests::io::Error[src]

impl<W> From<Arc<W>> for RawWaker where
    W: 'static + Wake + Send + Sync
1.51.0[src]

impl<W> From<Arc<W>> for Waker where
    W: 'static + Wake + Send + Sync
1.51.0[src]

impl<Y, E, F> From<Thunk<Result<Y, E>, F>> for Result<Y, E> where
    E: Sync,
    F: Sync + FnOnce() -> Result<Y, E>,
    Y: Sync
[src]

Loading content...