Enum RValue

Source
pub enum RValue {
Show 14 variants Tensor(TensorCell), TensorList(Vec<TensorCell>), Int(i64), IntList(Vec<i64>), Double(f64), Bool(bool), String(String), Device(Device), Layout(Layout), ScalarType(ScalarType), MemoryFormat(MemoryFormat), None, PyObject(PickledPyObject), Opaque(AliasTrackingRefCell<OpaqueIValue>),
}
Expand description

A pure Rust equivalent for IValue. This is safe to treat like a normal Rust value.

Variants§

§

Tensor(TensorCell)

§

TensorList(Vec<TensorCell>)

§

Int(i64)

§

IntList(Vec<i64>)

§

Double(f64)

§

Bool(bool)

§

String(String)

§

Device(Device)

§

Layout(Layout)

§

ScalarType(ScalarType)

§

MemoryFormat(MemoryFormat)

§

None

§

PyObject(PickledPyObject)

§

Opaque(AliasTrackingRefCell<OpaqueIValue>)

This is meant to be a catch-all for types that we don’t support natively in Rust.

Trait Implementations§

Source§

impl Clone for RValue

Source§

fn clone(&self) -> RValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RValue

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RValue

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Device> for RValue

Source§

fn from(value: Device) -> Self

Converts to this type from the input type.
Source§

impl From<IValue> for RValue

Source§

fn from(ivalue: IValue) -> Self

Converts to this type from the input type.
Source§

impl From<Layout> for RValue

Source§

fn from(value: Layout) -> Self

Converts to this type from the input type.
Source§

impl From<MemoryFormat> for RValue

Source§

fn from(value: MemoryFormat) -> Self

Converts to this type from the input type.
Source§

impl From<PickledPyObject> for RValue

Source§

fn from(value: PickledPyObject) -> Self

Converts to this type from the input type.
Source§

impl From<ScalarType> for RValue

Source§

fn from(value: ScalarType) -> Self

Converts to this type from the input type.
Source§

impl From<String> for RValue

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<AliasTrackingRefCell<Tensor>>> for RValue

Source§

fn from(value: Vec<TensorCell>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<i64>> for RValue

Source§

fn from(value: Vec<i64>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for RValue

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for RValue

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for RValue

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl FromPyObject<'_> for RValue

Source§

fn extract_bound(obj: &Bound<'_, PyAny>) -> PyResult<Self>

Extracts Self from the bound smart pointer obj. Read more
Source§

impl<'py> IntoPyObject<'py> for RValue

Source§

type Target = PyAny

The Python output type
Source§

type Output = Bound<'py, <RValue as IntoPyObject<'py>>::Target>

The smart pointer type to use. Read more
Source§

type Error = PyErr

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

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error>

Performs the conversion.
Source§

impl Serialize for RValue

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime TensorCell

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime Device

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime Layout

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime MemoryFormat

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime PickledPyObject

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime ScalarType

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime String

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime Vec<TensorCell>

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime Vec<i64>

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime bool

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime f64

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for &'__deriveMoreLifetime i64

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime RValue> for ()

Source§

type Error = TryIntoError<&'__deriveMoreLifetime RValue>

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

fn try_from(value: &'__deriveMoreLifetime RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut TensorCell

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut Device

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut Layout

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut MemoryFormat

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut PickledPyObject

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut ScalarType

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut String

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut Vec<TensorCell>

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut Vec<i64>

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut bool

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut f64

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for &'__deriveMoreLifetime mut i64

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime mut RValue> for ()

Source§

type Error = TryIntoError<&'__deriveMoreLifetime mut RValue>

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

fn try_from( value: &'__deriveMoreLifetime mut RValue, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for ()

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for TensorCell

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for Device

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for Layout

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for MemoryFormat

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for PickledPyObject

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for ScalarType

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for String

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for Vec<TensorCell>

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for Vec<i64>

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for bool

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for f64

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<RValue> for i64

Source§

type Error = TryIntoError<RValue>

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

fn try_from(value: RValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'py> TryIntoPyObjectUnsafe<'py, PyAny> for &RValue

Convert into a PyObject.

Source§

unsafe fn try_to_object_unsafe( self, py: Python<'py>, ) -> PyResult<Bound<'py, PyAny>>

Auto Trait Implementations§

§

impl !Freeze for RValue

§

impl !RefUnwindSafe for RValue

§

impl Send for RValue

§

impl Sync for RValue

§

impl Unpin for RValue

§

impl !UnwindSafe for RValue

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<'py, T> FromPyObjectBound<'_, 'py> for T
where T: FromPyObject<'py>,

§

fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<A, M> Handler<IndexedErasedUnbound<M>> for A
where A: Handler<M>, M: Castable,

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, A>, msg: IndexedErasedUnbound<M>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, A: 'async_trait,

Handle the next M-typed message.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<'py, T> IntoPyObjectExt<'py> for T
where T: IntoPyObject<'py>,

§

fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>

Converts self into an owned Python object, dropping type information.
§

fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>

Converts self into an owned Python object, dropping type information and unbinding it from the 'py lifetime.
§

fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>

Converts self into a Python object. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PyErrArguments for T
where T: for<'py> IntoPyObject<'py> + Send + Sync,

§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<M> Message for M
where M: Debug + Send + Sync + 'static,

§

impl<T> Ungil for T
where T: Send,