Skip to main content

FfiBuffer

Struct FfiBuffer 

Source
pub struct FfiBuffer { /* private fields */ }
Expand description

An argument or result buffer of an FFI call.

Implementations§

Source§

impl FfiBuffer

Source

pub fn dtype(&self) -> FfiDataType

Returns the element type.

Source

pub fn dims(&self) -> &[i64]

Returns the shape.

Source

pub fn as_slice<T: FfiElement>(&self) -> Result<&[T], String>

Views the elements as Ts, in row-major order.

§Errors

Returns an error message if the buffer’s type is not T.

Source

pub fn as_mut_slice<T: FfiElement>(&mut self) -> Result<&mut [T], String>

Views the elements as mutable Ts, in row-major order.

§Errors

Returns an error message if the buffer’s type is not T.

Source

pub fn as_f64(&self) -> Result<&[f64], String>

Views the elements as f64s, in row-major order.

§Errors

Returns an error message if the buffer is not f64.

Source

pub fn as_f64_mut(&mut self) -> Result<&mut [f64], String>

Views the elements as mutable f64s, in row-major order.

§Errors

Returns an error message if the buffer is not f64.

Trait Implementations§

Source§

impl Debug for FfiBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.