pub trait From<T> {
fn from(T) -> Self;
}
Expand description
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. The From
trait is intended for perfect conversions.
If the conversion can fail or is not perfect, use TryFrom
.
Generic Implementations
From<T> for U
impliesInto
<U> for T
From
is reflexive, which means thatFrom<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
Implementations on Foreign Types
1.6.0 · sourceimpl From<String> for Box<dyn Error + 'static, Global>
impl From<String> for Box<dyn Error + 'static, Global>
sourcefn from(str_err: String) -> Box<dyn Error + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(str_err: String) -> Box<dyn Error + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl<W> From<IntoInnerError<W>> for Error
impl<W> From<IntoInnerError<W>> for Error
fn from(iie: IntoInnerError<W>) -> Error
1.56.0 · sourceimpl<K, V, const N: usize> From<[(K, V); N]> for HashMap<K, V, RandomState> where
K: Eq + Hash,
impl<K, V, const N: usize> From<[(K, V); N]> for HashMap<K, V, RandomState> where
K: Eq + Hash,
1.16.0 · sourceimpl From<SocketAddrV4> for SocketAddr
impl From<SocketAddrV4> for SocketAddr
sourcefn from(sock4: SocketAddrV4) -> SocketAddr
fn from(sock4: SocketAddrV4) -> SocketAddr
Converts a SocketAddrV4
into a SocketAddr::V4
.
sourceimpl From<TcpListener> for OwnedFd
impl From<TcpListener> for OwnedFd
fn from(tcp_listener: TcpListener) -> OwnedFd
sourceimpl From<UnixDatagram> for OwnedFd
impl From<UnixDatagram> for OwnedFd
fn from(unix_datagram: UnixDatagram) -> OwnedFd
1.17.0 · sourceimpl<'_> From<&'_ Path> for Box<Path, Global>
impl<'_> From<&'_ Path> for Box<Path, Global>
sourcefn from(path: &Path) -> Box<Path, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(path: &Path) -> Box<Path, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Creates a boxed Path
from a reference.
This will allocate and clone path
to it.
1.16.0 · sourceimpl From<[u16; 8]> for Ipv6Addr
impl From<[u16; 8]> for Ipv6Addr
sourcefn from(segments: [u16; 8]) -> Ipv6Addr
fn from(segments: [u16; 8]) -> Ipv6Addr
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
);
sourceimpl<T> From<PoisonError<T>> for TryLockError<T>
impl<T> From<PoisonError<T>> for TryLockError<T>
fn from(err: PoisonError<T>) -> TryLockError<T>
1.20.0 · sourceimpl From<CString> for Box<CStr, Global>
impl From<CString> for Box<CStr, Global>
sourcefn from(s: CString) -> Box<CStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(s: CString) -> Box<CStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl<T> From<T> for SyncOnceCell<T>
impl<T> From<T> for SyncOnceCell<T>
sourcefn from(value: T) -> SyncOnceCell<T>
fn from(value: T) -> SyncOnceCell<T>
Create a new cell with its contents set to value
.
Example
#![feature(once_cell)]
use std::lazy::SyncOnceCell;
let a = SyncOnceCell::from(3);
let b = SyncOnceCell::new();
b.set(3)?;
assert_eq!(a, b);
Ok(())
1.22.0 · sourceimpl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a, Global>
impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a, Global>
sourcefn from(err: Cow<'b, str>) -> Box<dyn Error + Send + Sync + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(err: Cow<'b, str>) -> Box<dyn Error + Send + Sync + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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))
1.22.0 · sourceimpl<'a> From<Cow<'a, str>> for Box<dyn Error + 'static, Global>
impl<'a> From<Cow<'a, str>> for Box<dyn Error + 'static, Global>
sourcefn from(err: Cow<'a, str>) -> Box<dyn Error + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(err: Cow<'a, str>) -> Box<dyn Error + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl From<ChildStdout> for OwnedFd
impl From<ChildStdout> for OwnedFd
fn from(child_stdout: ChildStdout) -> OwnedFd
sourceimpl From<ChildStderr> for OwnedFd
impl From<ChildStderr> for OwnedFd
fn from(child_stderr: ChildStderr) -> OwnedFd
1.45.0 · sourceimpl<'_> From<Cow<'_, OsStr>> for Box<OsStr, Global>
impl<'_> From<Cow<'_, OsStr>> for Box<OsStr, Global>
sourcefn from(cow: Cow<'_, OsStr>) -> Box<OsStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(cow: Cow<'_, OsStr>) -> Box<OsStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl From<UnixListener> for OwnedFd
impl From<UnixListener> for OwnedFd
fn from(listener: UnixListener) -> OwnedFd
1.20.0 · sourceimpl From<OsString> for Box<OsStr, Global>
impl From<OsString> for Box<OsStr, Global>
sourcefn from(s: OsString) -> Box<OsStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(s: OsString) -> Box<OsStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
1.24.0 · sourceimpl<T> From<SendError<T>> for TrySendError<T>
impl<T> From<SendError<T>> for TrySendError<T>
sourcefn from(err: SendError<T>) -> TrySendError<T>
fn from(err: SendError<T>) -> TrySendError<T>
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.
1.20.0 · sourceimpl From<ChildStdout> for Stdio
impl From<ChildStdout> for Stdio
sourcefn from(child: ChildStdout) -> Stdio
fn from(child: ChildStdout) -> Stdio
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");
sourceimpl From<OwnedFd> for UnixStream
impl From<OwnedFd> for UnixStream
fn from(owned: OwnedFd) -> UnixStream
1.24.0 · sourceimpl From<RecvError> for TryRecvError
impl From<RecvError> for TryRecvError
sourcefn from(err: RecvError) -> TryRecvError
fn from(err: RecvError) -> TryRecvError
Converts a RecvError
into a TryRecvError
.
This conversion always returns TryRecvError::Disconnected
.
No data is allocated on the heap.
1.45.0 · sourceimpl<'_> From<Cow<'_, Path>> for Box<Path, Global>
impl<'_> From<Cow<'_, Path>> for Box<Path, Global>
sourcefn from(cow: Cow<'_, Path>) -> Box<Path, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(cow: Cow<'_, Path>) -> Box<Path, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Creates a boxed Path
from a clone-on-write pointer.
Converting from a Cow::Owned
does not clone or allocate.
1.20.0 · sourceimpl From<ChildStdin> for Stdio
impl From<ChildStdin> for Stdio
sourcefn from(child: ChildStdin) -> Stdio
fn from(child: ChildStdin) -> Stdio
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
sourceimpl From<UnixStream> for OwnedFd
impl From<UnixStream> for OwnedFd
fn from(unix_stream: UnixStream) -> OwnedFd
sourceimpl<'a, E> From<E> for Box<dyn Error + 'a, Global> where
E: 'a + Error,
impl<'a, E> From<E> for Box<dyn Error + 'a, Global> where
E: 'a + Error,
sourcefn from(err: E) -> Box<dyn Error + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(err: E) -> Box<dyn Error + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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))
sourceimpl<'a, '_> From<&'_ str> for Box<dyn Error + Send + Sync + 'a, Global>
impl<'a, '_> From<&'_ str> for Box<dyn Error + Send + Sync + 'a, Global>
sourcefn from(err: &str) -> Box<dyn Error + Send + Sync + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(err: &str) -> Box<dyn Error + Send + Sync + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
1.17.0 · sourceimpl<'_> From<&'_ CStr> for Box<CStr, Global>
impl<'_> From<&'_ CStr> for Box<CStr, Global>
sourcefn from(s: &CStr) -> Box<CStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(s: &CStr) -> Box<CStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Converts a &CStr
into a Box<CStr>
,
by copying the contents into a newly allocated Box
.
sourceimpl<'a, E> From<E> for Box<dyn Error + Send + Sync + 'a, Global> where
E: 'a + Error + Send + Sync,
impl<'a, E> From<E> for Box<dyn Error + Send + Sync + 'a, Global> where
E: 'a + Error + Send + Sync,
sourcefn from(err: E) -> Box<dyn Error + Send + Sync + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(err: E) -> Box<dyn Error + Send + Sync + 'a, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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))
1.17.0 · sourceimpl<'_> From<&'_ OsStr> for Box<OsStr, Global>
impl<'_> From<&'_ OsStr> for Box<OsStr, Global>
sourcefn from(s: &OsStr) -> Box<OsStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(s: &OsStr) -> Box<OsStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl From<OwnedFd> for TcpListener
impl From<OwnedFd> for TcpListener
fn from(owned_fd: OwnedFd) -> TcpListener
sourceimpl From<OwnedFd> for UnixListener
impl From<OwnedFd> for UnixListener
fn from(fd: OwnedFd) -> UnixListener
1.24.0 · sourceimpl<T> From<T> for RwLock<T>
impl<T> From<T> for RwLock<T>
sourcefn from(t: T) -> RwLock<T>
fn from(t: T) -> RwLock<T>
Creates a new instance of an RwLock<T>
which is unlocked.
This is equivalent to RwLock::new
.
1.9.0 · sourceimpl From<[u8; 16]> for Ipv6Addr
impl From<[u8; 16]> for Ipv6Addr
sourcefn from(octets: [u8; 16]) -> Ipv6Addr
fn from(octets: [u8; 16]) -> Ipv6Addr
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
);
1.24.0 · sourceimpl<T> From<T> for Mutex<T>
impl<T> From<T> for Mutex<T>
sourcefn from(t: T) -> Mutex<T>
fn from(t: T) -> Mutex<T>
Creates a new mutex in an unlocked state ready for use.
This is equivalent to Mutex::new
.
1.20.0 · sourceimpl From<File> for Stdio
impl From<File> for Stdio
sourcefn from(file: File) -> Stdio
fn from(file: File) -> 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");
1.17.0 · sourceimpl From<[u8; 16]> for IpAddr
impl From<[u8; 16]> for IpAddr
sourcefn from(octets: [u8; 16]) -> IpAddr
fn from(octets: [u8; 16]) -> IpAddr
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
);
1.20.0 · sourceimpl From<PathBuf> for Box<Path, Global>
impl From<PathBuf> for Box<Path, Global>
sourcefn from(p: PathBuf) -> Box<Path, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(p: PathBuf) -> Box<Path, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl From<OwnedFd> for UnixDatagram
impl From<OwnedFd> for UnixDatagram
fn from(owned: OwnedFd) -> UnixDatagram
1.24.0 · sourceimpl From<RecvError> for RecvTimeoutError
impl From<RecvError> for RecvTimeoutError
sourcefn from(err: RecvError) -> RecvTimeoutError
fn from(err: RecvError) -> RecvTimeoutError
Converts a RecvError
into a RecvTimeoutError
.
This conversion always returns RecvTimeoutError::Disconnected
.
No data is allocated on the heap.
1.17.0 · sourceimpl<I> From<(I, u16)> for SocketAddr where
I: Into<IpAddr>,
impl<I> From<(I, u16)> for SocketAddr where
I: Into<IpAddr>,
sourcefn from(pieces: (I, u16)) -> SocketAddr
fn from(pieces: (I, u16)) -> SocketAddr
Converts a tuple struct (Into<IpAddr
>, u16
) into a SocketAddr
.
This conversion creates a SocketAddr::V4
for an IpAddr::V4
and creates a SocketAddr::V6
for an IpAddr::V6
.
u16
is treated as port of the newly created SocketAddr
.
1.16.0 · sourceimpl From<SocketAddrV6> for SocketAddr
impl From<SocketAddrV6> for SocketAddr
sourcefn from(sock6: SocketAddrV6) -> SocketAddr
fn from(sock6: SocketAddrV6) -> SocketAddr
Converts a SocketAddrV6
into a SocketAddr::V6
.
1.6.0 · sourceimpl<'_> From<&'_ str> for Box<dyn Error + 'static, Global>
impl<'_> From<&'_ str> for Box<dyn Error + 'static, Global>
sourcefn from(err: &str) -> Box<dyn Error + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(err: &str) -> Box<dyn Error + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl From<String> for Box<dyn Error + Send + Sync + 'static, Global>
impl From<String> for Box<dyn Error + Send + Sync + 'static, Global>
sourcefn from(err: String) -> Box<dyn Error + Send + Sync + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(err: String) -> Box<dyn Error + Send + Sync + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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))
1.45.0 · sourceimpl<'_> From<Cow<'_, CStr>> for Box<CStr, Global>
impl<'_> From<Cow<'_, CStr>> for Box<CStr, Global>
sourcefn from(cow: Cow<'_, CStr>) -> Box<CStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(cow: Cow<'_, CStr>) -> Box<CStr, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Converts a Cow<'a, CStr>
into a Box<CStr>
,
by copying the contents if they are borrowed.
1.14.0 · sourceimpl From<ErrorKind> for Error
impl From<ErrorKind> for Error
Intended for use for errors not exposed to the user, where allocating onto the heap (for normal construction via Error::new) is too costly.
1.17.0 · sourceimpl From<[u16; 8]> for IpAddr
impl From<[u16; 8]> for IpAddr
sourcefn from(segments: [u16; 8]) -> IpAddr
fn from(segments: [u16; 8]) -> IpAddr
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
);
1.20.0 · sourceimpl From<ChildStderr> for Stdio
impl From<ChildStderr> for Stdio
sourcefn from(child: ChildStderr) -> Stdio
fn from(child: ChildStderr) -> Stdio
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"
);
sourceimpl From<ChildStdin> for OwnedFd
impl From<ChildStdin> for OwnedFd
fn from(child_stdin: ChildStdin) -> OwnedFd
1.31.0 (const: unstable) · sourceimpl From<NonZeroI16> for i16
impl From<NonZeroI16> for i16
const: unstable · sourcefn from(nonzero: NonZeroI16) -> i16
fn from(nonzero: NonZeroI16) -> i16
Converts a NonZeroI16
into an i16
1.31.0 (const: unstable) · sourceimpl From<NonZeroU32> for u32
impl From<NonZeroU32> for u32
const: unstable · sourcefn from(nonzero: NonZeroU32) -> u32
fn from(nonzero: NonZeroU32) -> u32
Converts a NonZeroU32
into an u32
1.31.0 (const: unstable) · sourceimpl From<NonZeroU16> for u16
impl From<NonZeroU16> for u16
const: unstable · sourcefn from(nonzero: NonZeroU16) -> u16
fn from(nonzero: NonZeroU16) -> u16
Converts a NonZeroU16
into an u16
1.31.0 (const: unstable) · sourceimpl From<NonZeroI32> for i32
impl From<NonZeroI32> for i32
const: unstable · sourcefn from(nonzero: NonZeroI32) -> i32
fn from(nonzero: NonZeroI32) -> i32
Converts a NonZeroI32
into an i32
1.31.0 (const: unstable) · sourceimpl From<NonZeroI64> for i64
impl From<NonZeroI64> for i64
const: unstable · sourcefn from(nonzero: NonZeroI64) -> i64
fn from(nonzero: NonZeroI64) -> i64
Converts a NonZeroI64
into an i64
1.31.0 (const: unstable) · sourceimpl From<NonZeroU64> for u64
impl From<NonZeroU64> for u64
const: unstable · sourcefn from(nonzero: NonZeroU64) -> u64
fn from(nonzero: NonZeroU64) -> u64
Converts a NonZeroU64
into an u64
sourceimpl<T, const LANES: usize> From<Mask<T, LANES>> for [bool; LANES] where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
impl<T, const LANES: usize> From<Mask<T, LANES>> for [bool; LANES] where
T: MaskElement,
LaneCount<LANES>: SupportedLaneCount,
1.13.0 (const: unstable) · sourceimpl From<u8> for char
impl From<u8> for char
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.
1.31.0 (const: unstable) · sourceimpl From<NonZeroIsize> for isize
impl From<NonZeroIsize> for isize
const: unstable · sourcefn from(nonzero: NonZeroIsize) -> isize
fn from(nonzero: NonZeroIsize) -> isize
Converts a NonZeroIsize
into an isize
1.31.0 (const: unstable) · sourceimpl From<NonZeroI128> for i128
impl From<NonZeroI128> for i128
const: unstable · sourcefn from(nonzero: NonZeroI128) -> i128
fn from(nonzero: NonZeroI128) -> i128
Converts a NonZeroI128
into an i128
1.31.0 (const: unstable) · sourceimpl From<NonZeroUsize> for usize
impl From<NonZeroUsize> for usize
const: unstable · sourcefn from(nonzero: NonZeroUsize) -> usize
fn from(nonzero: NonZeroUsize) -> usize
Converts a NonZeroUsize
into an usize
1.31.0 (const: unstable) · sourceimpl From<NonZeroU128> for u128
impl From<NonZeroU128> for u128
const: unstable · sourcefn from(nonzero: NonZeroU128) -> u128
fn from(nonzero: NonZeroU128) -> u128
Converts a NonZeroU128
into an u128
sourceimpl<T, const LANES: usize> From<Simd<T, LANES>> for [T; LANES] where
T: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
impl<T, const LANES: usize> From<Simd<T, LANES>> for [T; LANES] where
T: SimdElement,
LaneCount<LANES>: SupportedLaneCount,
1.19.0 · sourceimpl<A> From<Box<str, A>> for Box<[u8], A> where
A: Allocator,
impl<A> From<Box<str, A>> for Box<[u8], A> where
A: Allocator,
sourcefn from(s: Box<str, A>) -> Box<[u8], A>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(s: Box<str, A>) -> Box<[u8], A>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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);
1.45.0 · sourceimpl<T, const N: usize> From<[T; N]> for Box<[T], Global>
impl<T, const N: usize> From<[T; N]> for Box<[T], Global>
sourcefn from(array: [T; N]) -> Box<[T], Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(array: [T; N]) -> Box<[T], Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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:?}");
sourceimpl From<TryReserveErrorKind> for TryReserveError
impl From<TryReserveErrorKind> for TryReserveError
fn from(kind: TryReserveErrorKind) -> TryReserveError
1.45.0 · sourceimpl<'_, T> From<Cow<'_, [T]>> for Box<[T], Global> where
T: Copy,
impl<'_, T> From<Cow<'_, [T]>> for Box<[T], Global> where
T: Copy,
sourcefn from(cow: Cow<'_, [T]>) -> Box<[T], Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(cow: Cow<'_, [T]>) -> Box<[T], Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Converts a Cow<'_, [T]>
into a Box<[T]>
When cow
is the Cow::Borrowed
variant, this
conversion allocates on the heap and copies the
underlying slice. Otherwise, it will try to reuse the owned
Vec
’s allocation.
1.45.0 · sourceimpl<'_> From<Cow<'_, str>> for Box<str, Global>
impl<'_> From<Cow<'_, str>> for Box<str, Global>
sourcefn from(cow: Cow<'_, str>) -> Box<str, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(cow: Cow<'_, str>) -> Box<str, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Converts a Cow<'_, str>
into a Box<str>
When cow
is the Cow::Borrowed
variant, this
conversion allocates on the heap and copies the
underlying str
. Otherwise, it will try to reuse the owned
String
’s allocation.
Examples
use std::borrow::Cow;
let unboxed = Cow::Borrowed("hello");
let boxed: Box<str> = Box::from(unboxed);
println!("{boxed}");
let unboxed = Cow::Owned("hello".to_string());
let boxed: Box<str> = Box::from(unboxed);
println!("{boxed}");
1.14.0 · sourceimpl<'a> From<Cow<'a, str>> for String
impl<'a> From<Cow<'a, str>> for String
sourcefn from(s: Cow<'a, str>) -> String
fn from(s: Cow<'a, str>) -> String
Converts a clone-on-write string to an owned
instance of String
.
This extracts the owned string, clones the string if it is not already owned.
Example
// If the string is not owned...
let cow: Cow<str> = Cow::Borrowed("eggplant");
// It will allocate on the heap and copy the string.
let owned: String = String::from(cow);
assert_eq!(&owned[..], "eggplant");
1.45.0 · sourceimpl<'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>,
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.10.0 · sourceimpl<T, A> From<VecDeque<T, A>> for Vec<T, A> where
A: Allocator,
impl<T, A> From<VecDeque<T, A>> for Vec<T, A> where
A: Allocator,
sourcefn from(other: VecDeque<T, A>) -> Vec<T, A>
fn from(other: VecDeque<T, A>) -> Vec<T, A>
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);
1.6.0 · sourceimpl<T> From<T> for Box<T, Global>
impl<T> From<T> for Box<T, Global>
sourcefn from(t: T) -> Box<T, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(t: T) -> Box<T, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Converts a 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);
sourceimpl From<LayoutError> for TryReserveErrorKind
impl From<LayoutError> for TryReserveErrorKind
sourcefn from(LayoutError) -> TryReserveErrorKind
fn from(LayoutError) -> TryReserveErrorKind
Always evaluates to TryReserveErrorKind::CapacityOverflow
.
1.14.0 · sourceimpl<'a, T> From<Cow<'a, [T]>> for Vec<T, Global> where
[T]: ToOwned,
<[T] as ToOwned>::Owned == Vec<T, Global>,
impl<'a, T> From<Cow<'a, [T]>> for Vec<T, Global> where
[T]: ToOwned,
<[T] as ToOwned>::Owned == Vec<T, Global>,
sourcefn from(s: Cow<'a, [T]>) -> Vec<T, Global>
fn from(s: Cow<'a, [T]>) -> Vec<T, Global>
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));
1.20.0 · sourceimpl<T, A> From<Vec<T, A>> for Box<[T], A> where
A: Allocator,
impl<T, A> From<Vec<T, A>> for Box<[T], A> where
A: Allocator,
sourcefn from(v: Vec<T, A>) -> Box<[T], A>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(v: Vec<T, A>) -> Box<[T], A>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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());
1.56.0 · sourceimpl<T, const N: usize> From<[T; N]> for BinaryHeap<T> where
T: Ord,
impl<T, const N: usize> From<[T; N]> for BinaryHeap<T> where
T: Ord,
sourcefn from(arr: [T; N]) -> BinaryHeap<T>
fn from(arr: [T; N]) -> BinaryHeap<T>
use std::collections::BinaryHeap;
let mut h1 = BinaryHeap::from([1, 4, 2, 3]);
let mut h2: BinaryHeap<_> = [1, 4, 2, 3].into();
while let Some((a, b)) = h1.pop().zip(h2.pop()) {
assert_eq!(a, b);
}
1.17.0 · sourceimpl<'_, T> From<&'_ [T]> for Box<[T], Global> where
T: Copy,
impl<'_, T> From<&'_ [T]> for Box<[T], Global> where
T: Copy,
sourcefn from(slice: &[T]) -> Box<[T], Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(slice: &[T]) -> Box<[T], Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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:?}");
1.5.0 · sourceimpl<T> From<BinaryHeap<T>> for Vec<T, Global>
impl<T> From<BinaryHeap<T>> for Vec<T, Global>
sourcefn from(heap: BinaryHeap<T>) -> Vec<T, Global>
fn from(heap: BinaryHeap<T>) -> Vec<T, Global>
Converts a BinaryHeap<T>
into a Vec<T>
.
This conversion requires no data movement or allocation, and has constant time complexity.
1.20.0 · sourceimpl From<String> for Box<str, Global>
impl From<String> for Box<str, Global>
sourcefn from(s: String) -> Box<str, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(s: String) -> Box<str, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
1.56.0 · sourceimpl<T, const N: usize> From<[T; N]> for LinkedList<T>
impl<T, const N: usize> From<[T; N]> for LinkedList<T>
sourcefn from(arr: [T; N]) -> LinkedList<T>
fn from(arr: [T; N]) -> LinkedList<T>
Converts a [T; N]
into a LinkedList<T>
.
use std::collections::LinkedList;
let list1 = LinkedList::from([1, 2, 3, 4]);
let list2: LinkedList<_> = [1, 2, 3, 4].into();
assert_eq!(list1, list2);
1.17.0 · sourceimpl<'_> From<&'_ str> for Box<str, Global>
impl<'_> From<&'_ str> for Box<str, Global>
sourcefn from(s: &str) -> Box<str, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn from(s: &str) -> Box<str, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
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}");
1.5.0 · sourceimpl<T> From<Vec<T, Global>> for BinaryHeap<T> where
T: Ord,
impl<T> From<Vec<T, Global>> for BinaryHeap<T> where
T: Ord,
sourcefn from(vec: Vec<T, Global>) -> BinaryHeap<T>
fn from(vec: Vec<T, Global>) -> BinaryHeap<T>
Converts a Vec<T>
into a BinaryHeap<T>
.
This conversion happens in-place, and has O(n) time complexity.
1.45.0 · sourceimpl<'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>,
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>,
sourceimpl<K, V, const N: usize> From<[(K, V); N]> for IndexMap<K, V, RandomState> where
K: Hash + Eq,
impl<K, V, const N: usize> From<[(K, V); N]> for IndexMap<K, V, RandomState> where
K: Hash + Eq,
sourceimpl From<Error> for Box<dyn Error + 'static, Global>
impl From<Error> for Box<dyn Error + 'static, Global>
fn from(error: Error) -> Box<dyn Error + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl From<Error> for Box<dyn Error + Send + 'static, Global>
impl From<Error> for Box<dyn Error + Send + 'static, Global>
fn from(error: Error) -> Box<dyn Error + Send + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl From<Error> for Box<dyn Error + Send + Sync + 'static, Global>
impl From<Error> for Box<dyn Error + Send + Sync + 'static, Global>
fn from(error: Error) -> Box<dyn Error + Send + Sync + 'static, Global>ⓘNotable traits for Box<I, A>impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
sourceimpl<'v> From<&'v NonZeroI128> for Value<'v>
impl<'v> From<&'v NonZeroI128> for Value<'v>
fn from(v: &'v NonZeroI128) -> Value<'v>
sourceimpl<'v> From<NonZeroUsize> for Value<'v>
impl<'v> From<NonZeroUsize> for Value<'v>
fn from(value: NonZeroUsize) -> Value<'v>
sourceimpl<'v> From<&'v NonZeroU128> for Value<'v>
impl<'v> From<&'v NonZeroU128> for Value<'v>
fn from(v: &'v NonZeroU128) -> Value<'v>
sourceimpl<'v> From<NonZeroU64> for Value<'v>
impl<'v> From<NonZeroU64> for Value<'v>
fn from(value: NonZeroU64) -> Value<'v>
sourceimpl<'v> From<NonZeroU32> for Value<'v>
impl<'v> From<NonZeroU32> for Value<'v>
fn from(value: NonZeroU32) -> Value<'v>
sourceimpl<'v> From<NonZeroI16> for Value<'v>
impl<'v> From<NonZeroI16> for Value<'v>
fn from(value: NonZeroI16) -> Value<'v>
sourceimpl<'v> From<NonZeroI32> for Value<'v>
impl<'v> From<NonZeroI32> for Value<'v>
fn from(value: NonZeroI32) -> Value<'v>
sourceimpl<'v> From<NonZeroIsize> for Value<'v>
impl<'v> From<NonZeroIsize> for Value<'v>
fn from(value: NonZeroIsize) -> Value<'v>
sourceimpl<'v> From<NonZeroI64> for Value<'v>
impl<'v> From<NonZeroI64> for Value<'v>
fn from(value: NonZeroI64) -> Value<'v>
sourceimpl<'v> From<NonZeroU16> for Value<'v>
impl<'v> From<NonZeroU16> for Value<'v>
fn from(value: NonZeroU16) -> Value<'v>
sourceimpl<W> From<W> for DebugRngLists<W> where
W: Writer,
impl<W> From<W> for DebugRngLists<W> where
W: Writer,
fn from(w: W) -> DebugRngLists<W>
sourceimpl<R> From<R> for DebugLineStr<R>
impl<R> From<R> for DebugLineStr<R>
fn from(section: R) -> DebugLineStr<R>
sourceimpl<R> From<R> for DebugTuIndex<R>
impl<R> From<R> for DebugTuIndex<R>
fn from(section: R) -> DebugTuIndex<R>
sourceimpl<R> From<R> for DebugPubTypes<R> where
R: Reader,
impl<R> From<R> for DebugPubTypes<R> where
R: Reader,
fn from(debug_pubtypes_section: R) -> DebugPubTypes<R>
sourceimpl<R> From<R> for DebugStrOffsets<R>
impl<R> From<R> for DebugStrOffsets<R>
fn from(section: R) -> DebugStrOffsets<R>
sourceimpl From<Error> for ConvertError
impl From<Error> for ConvertError
fn from(e: Error) -> ConvertError
sourceimpl<R> From<R> for DebugCuIndex<R>
impl<R> From<R> for DebugCuIndex<R>
fn from(section: R) -> DebugCuIndex<R>
sourceimpl<T> From<T> for DebugFrameOffset<T>
impl<T> From<T> for DebugFrameOffset<T>
fn from(o: T) -> DebugFrameOffset<T>
sourceimpl<R> From<R> for DebugRanges<R>
impl<R> From<R> for DebugRanges<R>
fn from(section: R) -> DebugRanges<R>
sourceimpl<R> From<R> for DebugRngLists<R>
impl<R> From<R> for DebugRngLists<R>
fn from(section: R) -> DebugRngLists<R>
sourceimpl<R> From<R> for DebugFrame<R> where
R: Reader,
impl<R> From<R> for DebugFrame<R> where
R: Reader,
fn from(section: R) -> DebugFrame<R>
sourceimpl<R> From<R> for DebugTypes<R>
impl<R> From<R> for DebugTypes<R>
fn from(debug_types_section: R) -> DebugTypes<R>
sourceimpl<R> From<R> for DebugAbbrev<R>
impl<R> From<R> for DebugAbbrev<R>
fn from(debug_abbrev_section: R) -> DebugAbbrev<R>
sourceimpl<T> From<DebugInfoOffset<T>> for UnitSectionOffset<T>
impl<T> From<DebugInfoOffset<T>> for UnitSectionOffset<T>
fn from(offset: DebugInfoOffset<T>) -> UnitSectionOffset<T>
sourceimpl<W> From<W> for DebugFrame<W> where
W: Writer,
impl<W> From<W> for DebugFrame<W> where
W: Writer,
fn from(w: W) -> DebugFrame<W>
sourceimpl<R> From<R> for DebugAranges<R>
impl<R> From<R> for DebugAranges<R>
fn from(section: R) -> DebugAranges<R>
sourceimpl<R> From<R> for EhFrameHdr<R> where
R: Reader,
impl<R> From<R> for EhFrameHdr<R> where
R: Reader,
fn from(section: R) -> EhFrameHdr<R>
sourceimpl<W> From<W> for DebugLineStr<W> where
W: Writer,
impl<W> From<W> for DebugLineStr<W> where
W: Writer,
fn from(w: W) -> DebugLineStr<W>
sourceimpl<T> From<DebugTypesOffset<T>> for UnitSectionOffset<T>
impl<T> From<DebugTypesOffset<T>> for UnitSectionOffset<T>
fn from(offset: DebugTypesOffset<T>) -> UnitSectionOffset<T>
sourceimpl<R> From<R> for DebugLocLists<R>
impl<R> From<R> for DebugLocLists<R>
fn from(section: R) -> DebugLocLists<R>
sourceimpl<W> From<W> for DebugLocLists<W> where
W: Writer,
impl<W> From<W> for DebugLocLists<W> where
W: Writer,
fn from(w: W) -> DebugLocLists<W>
sourceimpl<T> From<T> for EhFrameOffset<T>
impl<T> From<T> for EhFrameOffset<T>
fn from(o: T) -> EhFrameOffset<T>
sourceimpl<R> From<R> for DebugPubNames<R> where
R: Reader,
impl<R> From<R> for DebugPubNames<R> where
R: Reader,
fn from(debug_pubnames_section: R) -> DebugPubNames<R>
sourceimpl<W> From<W> for DebugRanges<W> where
W: Writer,
impl<W> From<W> for DebugRanges<W> where
W: Writer,
fn from(w: W) -> DebugRanges<W>
sourceimpl<W> From<W> for DebugAbbrev<W> where
W: Writer,
impl<W> From<W> for DebugAbbrev<W> where
W: Writer,
fn from(w: W) -> DebugAbbrev<W>
Implementors
impl From<WasmError> for CompileError
impl From<WasmType> for ValType
impl From<Infallible> for TryFromSliceError
impl From<Infallible> for TryFromIntError
impl From<bool> for AtomicBool
impl From<i8> for AtomicI8
impl From<i16> for AtomicI16
impl From<i32> for AtomicI32
impl From<i64> for AtomicI64
impl From<isize> for AtomicIsize
impl From<!> for Infallible
impl From<!> for TryFromIntError
impl From<u8> for AtomicU8
impl From<u16> for AtomicU16
impl From<u32> for AtomicU32
impl From<u64> for AtomicU64
impl From<usize> for AtomicUsize
impl From<FuncIndex> for EntityIndex
impl From<GlobalIndex> for EntityIndex
impl From<MemoryIndex> for EntityIndex
impl From<TableIndex> for EntityIndex
impl From<BinaryReaderError> for WasmError
impl From<MemoryType> for Memory
impl From<TagType> for Tag
impl From<__m128> for Simd<f32, 4_usize>
impl From<__m128d> for Simd<f64, 2_usize>
impl From<__m128i> for Simd<i8, 16_usize>
impl From<__m128i> for Simd<i16, 8_usize>
impl From<__m128i> for Simd<i32, 4_usize>
impl From<__m128i> for Simd<i64, 2_usize>
impl From<__m128i> for Simd<isize, 2_usize>
impl From<__m128i> for Simd<u8, 16_usize>
impl From<__m128i> for Simd<u16, 8_usize>
impl From<__m128i> for Simd<u32, 4_usize>
impl From<__m128i> for Simd<u64, 2_usize>
impl From<__m128i> for Simd<usize, 2_usize>
impl From<__m256> for Simd<f32, 8_usize>
impl From<__m256d> for Simd<f64, 4_usize>
impl From<__m256i> for Simd<i8, 32_usize>
impl From<__m256i> for Simd<i16, 16_usize>
impl From<__m256i> for Simd<i32, 8_usize>
impl From<__m256i> for Simd<i64, 4_usize>
impl From<__m256i> for Simd<isize, 4_usize>
impl From<__m256i> for Simd<u8, 32_usize>
impl From<__m256i> for Simd<u16, 16_usize>
impl From<__m256i> for Simd<u32, 8_usize>
impl From<__m256i> for Simd<u64, 4_usize>
impl From<__m256i> for Simd<usize, 4_usize>
impl From<__m512> for Simd<f32, 16_usize>
impl From<__m512d> for Simd<f64, 8_usize>
impl From<__m512i> for Simd<i8, 64_usize>
impl From<__m512i> for Simd<i16, 32_usize>
impl From<__m512i> for Simd<i32, 16_usize>
impl From<__m512i> for Simd<i64, 8_usize>
impl From<__m512i> for Simd<isize, 8_usize>
impl From<__m512i> for Simd<u8, 64_usize>
impl From<__m512i> for Simd<u16, 32_usize>
impl From<__m512i> for Simd<u32, 16_usize>
impl From<__m512i> for Simd<u64, 8_usize>
impl From<__m512i> for Simd<usize, 8_usize>
impl From<NonZeroI8> for NonZeroI16
impl From<NonZeroI8> for NonZeroI32
impl From<NonZeroI8> for NonZeroI64
impl From<NonZeroI8> for NonZeroI128
impl From<NonZeroI8> for NonZeroIsize
impl From<NonZeroI16> for NonZeroI32
impl From<NonZeroI16> for NonZeroI64
impl From<NonZeroI16> for NonZeroI128
impl From<NonZeroI16> for NonZeroIsize
impl From<NonZeroI32> for NonZeroI64
impl From<NonZeroI32> for NonZeroI128
impl From<NonZeroI64> for NonZeroI128
impl From<NonZeroU8> for NonZeroI16
impl From<NonZeroU8> for NonZeroI32
impl From<NonZeroU8> for NonZeroI64
impl From<NonZeroU8> for NonZeroI128
impl From<NonZeroU8> for NonZeroIsize
impl From<NonZeroU8> for NonZeroU16
impl From<NonZeroU8> for NonZeroU32
impl From<NonZeroU8> for NonZeroU64
impl From<NonZeroU8> for NonZeroU128
impl From<NonZeroU8> for NonZeroUsize
impl From<NonZeroU16> for NonZeroI32
impl From<NonZeroU16> for NonZeroI64
impl From<NonZeroU16> for NonZeroI128
impl From<NonZeroU16> for NonZeroU32
impl From<NonZeroU16> for NonZeroU64
impl From<NonZeroU16> for NonZeroU128
impl From<NonZeroU16> for NonZeroUsize
impl From<NonZeroU32> for NonZeroI64
impl From<NonZeroU32> for NonZeroI128
impl From<NonZeroU32> for NonZeroU64
impl From<NonZeroU32> for NonZeroU128
impl From<NonZeroU64> for NonZeroI128
impl From<NonZeroU64> for NonZeroU128
impl From<Simd<f32, 4_usize>> for __m128
impl From<Simd<f32, 8_usize>> for __m256
impl From<Simd<f32, 16_usize>> for __m512
impl From<Simd<f64, 2_usize>> for __m128d
impl From<Simd<f64, 4_usize>> for __m256d
impl From<Simd<f64, 8_usize>> for __m512d
impl From<Simd<i8, 16_usize>> for __m128i
impl From<Simd<i8, 32_usize>> for __m256i
impl From<Simd<i8, 64_usize>> for __m512i
impl From<Simd<i16, 8_usize>> for __m128i
impl From<Simd<i16, 16_usize>> for __m256i
impl From<Simd<i16, 32_usize>> for __m512i
impl From<Simd<i32, 4_usize>> for __m128i
impl From<Simd<i32, 8_usize>> for __m256i
impl From<Simd<i32, 16_usize>> for __m512i
impl From<Simd<i64, 2_usize>> for __m128i
impl From<Simd<i64, 4_usize>> for __m256i
impl From<Simd<i64, 8_usize>> for __m512i
impl From<Simd<isize, 2_usize>> for __m128i
impl From<Simd<isize, 4_usize>> for __m256i
impl From<Simd<isize, 8_usize>> for __m512i
impl From<Simd<u8, 16_usize>> for __m128i
impl From<Simd<u8, 32_usize>> for __m256i
impl From<Simd<u8, 64_usize>> for __m512i
impl From<Simd<u16, 8_usize>> for __m128i
impl From<Simd<u16, 16_usize>> for __m256i
impl From<Simd<u16, 32_usize>> for __m512i
impl From<Simd<u32, 4_usize>> for __m128i
impl From<Simd<u32, 8_usize>> for __m256i
impl From<Simd<u32, 16_usize>> for __m512i
impl From<Simd<u64, 2_usize>> for __m128i
impl From<Simd<u64, 4_usize>> for __m256i
impl From<Simd<u64, 8_usize>> for __m512i
impl From<Simd<usize, 2_usize>> for __m128i
impl From<Simd<usize, 4_usize>> for __m256i
impl From<Simd<usize, 8_usize>> for __m512i
impl From<StreamResult> for Result<MZStatus, MZError>
impl<'_> From<&'_ StreamResult> for Result<MZStatus, MZError>
impl<'_, T> From<&'_ T> for NonNull<T> where
T: ?Sized,
impl<'_, T> From<&'_ mut T> for NonNull<T> where
T: ?Sized,
impl<'a, T> From<&'a Option<T>> for Option<&'a T>
impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T>
impl<P: PtrSize> From<VMOffsetsFields<P>> for VMOffsets<P>
impl<T> From<Option<T>> for PackedOption<T> where
T: ReservedValue,
impl<T> From<!> for T
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.