pub trait Append<T>: Sized {
// Required method
fn append_back(&mut self, _: T) -> &mut Self;
}
Expand description
append function for List can append any data type
Required Methods§
Sourcefn append_back(&mut self, _: T) -> &mut Self
fn append_back(&mut self, _: T) -> &mut Self
Performs append
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl Append<&str> for List
impl Append<Object> for List
impl Append<bool> for List
impl Append<char> for List
impl Append<f32> for List
impl Append<f64> for List
impl Append<i32> for List
inline append for integer example
let mut one_elem = List::new(); one_elem .append_back(123) .append_back(123) .append_back(123) .append_back(123) .append_back(123) .append_back(123) .append_back(123); println!(“{}”, one_elem);
[123, 123, 123, 123, 123, 123, 123]