[−][src]Struct sixtyfps_corelib::slice::Slice
That's basicaly the same as &'a [T]
but repr(C)
Can be constructed from a slice using the from trait.
use sixtyfps_corelib::slice::Slice; let x = Slice::from_slice(&[1, 2, 3]); assert_eq!(x.len(), 3); assert_eq!(x[1], 2); let slice : &'static [u32] = x.as_slice();
Comparing two Slice compare their pointer, not the content.
use sixtyfps_corelib::slice::Slice; let a = Slice::from_slice(&[1, 2, 3]); let slice = [1, 2, 3, 4]; let b = Slice::from(&slice[..3]); // two slice coming from the same pointer are equal. assert_eq!(b, Slice::from(&slice[..3])); // these are different because the pointers are different assert_ne!(a, b); // use as_slice to compare the contents assert_eq!(a.as_slice(), b.as_slice());
Implementations
impl<'a, T> Slice<'a, T>
[src]
pub fn as_slice(self) -> &'a [T]
[src]
Return a slice
pub fn from_slice(x: &'a [T]) -> Self
[src]
Create from a native slice
Trait Implementations
impl<'a, T> Clone for Slice<'a, T>
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T> Copy for Slice<'a, T>
[src]
impl<'a, T: Debug> Debug for Slice<'a, T>
[src]
impl<'a, T> Deref for Slice<'a, T>
[src]
impl<'a, T> From<&'a [T]> for Slice<'a, T>
[src]
impl<'a, T: PartialEq> PartialEq<Slice<'a, T>> for Slice<'a, T>
[src]
pub fn eq(&self, other: &Slice<'a, T>) -> bool
[src]
pub fn ne(&self, other: &Slice<'a, T>) -> bool
[src]
impl<'a, T> StructuralPartialEq for Slice<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Slice<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> !Send for Slice<'a, T>
impl<'a, T> !Sync for Slice<'a, T>
impl<'a, T> Unpin for Slice<'a, T>
impl<'a, T> UnwindSafe for Slice<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,