pub enum UnitVolume {
CubicMillimeters,
CubicCentimeters,
CubicFeet,
CubicInches,
CubicMeters,
CubicYards,
FluidOunces,
Gallons,
Liters,
Milliliters,
}Expand description
The valid types of volume units.
Variants§
CubicMillimeters
Cubic millimeters (mm³)
CubicCentimeters
Cubic centimeters (cc or cm³) https://en.wikipedia.org/wiki/Cubic_centimeter
CubicFeet
Cubic feet (ft³) https://en.wikipedia.org/wiki/Cubic_foot
CubicInches
Cubic inches (cu in or in³) https://en.wikipedia.org/wiki/Cubic_inch
CubicMeters
Cubic meters (m³) https://en.wikipedia.org/wiki/Cubic_meter
CubicYards
Cubic yards (yd³) https://en.wikipedia.org/wiki/Cubic_yard
FluidOunces
US Fluid Ounces (fl oz) https://en.wikipedia.org/wiki/Fluid_ounce
Gallons
US Gallons (gal US) https://en.wikipedia.org/wiki/Gallon
Liters
Liters (l) https://en.wikipedia.org/wiki/Litre
Milliliters
Milliliters (ml) https://en.wikipedia.org/wiki/Litre
Implementations§
Source§impl UnitVolume
impl UnitVolume
Sourcepub fn convert_to(&self, to: UnitVolume, input: f64) -> f64
pub fn convert_to(&self, to: UnitVolume, input: f64) -> f64
Do a unit conversion for this type.
Source§impl UnitVolume
impl UnitVolume
Sourcepub fn as_measurement(self, value: f64) -> Volume
pub fn as_measurement(self, value: f64) -> Volume
Convert to measurement.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for UnitVolume
impl<'arbitrary> Arbitrary<'arbitrary> for UnitVolume
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for UnitVolume
impl Clone for UnitVolume
Source§fn clone(&self) -> UnitVolume
fn clone(&self) -> UnitVolume
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for UnitVolume
Source§impl Debug for UnitVolume
impl Debug for UnitVolume
Source§impl Default for UnitVolume
impl Default for UnitVolume
Source§fn default() -> UnitVolume
fn default() -> UnitVolume
Source§impl<'de> Deserialize<'de> for UnitVolume
impl<'de> Deserialize<'de> for UnitVolume
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for UnitVolume
impl Display for UnitVolume
impl Eq for UnitVolume
Source§impl<'a, 'py> FromPyObject<'a, 'py> for UnitVolumewhere
Self: Clone,
impl<'a, 'py> FromPyObject<'a, 'py> for UnitVolumewhere
Self: Clone,
Source§impl FromStr for UnitVolume
impl FromStr for UnitVolume
Source§impl Hash for UnitVolume
impl Hash for UnitVolume
Source§impl<'py> IntoPyObject<'py> for UnitVolume
impl<'py> IntoPyObject<'py> for UnitVolume
Source§type Target = UnitVolume
type Target = UnitVolume
Source§type Output = Bound<'py, <UnitVolume as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <UnitVolume as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'py>>::Output, <Self as IntoPyObject<'py>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'py>>::Output, <Self as IntoPyObject<'py>>::Error>
Source§impl JsonSchema for UnitVolume
impl JsonSchema for UnitVolume
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl Ord for UnitVolume
impl Ord for UnitVolume
Source§fn cmp(&self, other: &UnitVolume) -> Ordering
fn cmp(&self, other: &UnitVolume) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for UnitVolume
impl PartialEq for UnitVolume
Source§fn eq(&self, other: &UnitVolume) -> bool
fn eq(&self, other: &UnitVolume) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for UnitVolume
impl PartialOrd for UnitVolume
Source§impl PyClass for UnitVolume
impl PyClass for UnitVolume
Source§impl PyClassImpl for UnitVolume
impl PyClassImpl for UnitVolume
Source§const MODULE: Option<&str> = ::core::option::Option::None
const MODULE: Option<&str> = ::core::option::Option::None
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// The valid types of volume units.
const RAW_DOC: &'static CStr = /// The valid types of volume units.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type Layout = <<UnitVolume as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<UnitVolume>
type Layout = <<UnitVolume as PyClassImpl>::BaseNativeType as PyClassBaseType>::Layout<UnitVolume>
Source§type ThreadChecker = NoopThreadChecker
type ThreadChecker = NoopThreadChecker
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
Source§fn dict_offset() -> Option<PyObjectOffset>
fn dict_offset() -> Option<PyObjectOffset>
Source§fn weaklist_offset() -> Option<PyObjectOffset>
fn weaklist_offset() -> Option<PyObjectOffset>
Source§impl PyRuntimeType for UnitVolume
impl PyRuntimeType for UnitVolume
Source§impl PyStubType for UnitVolume
impl PyStubType for UnitVolume
Source§fn type_output() -> TypeInfo
fn type_output() -> TypeInfo
Source§fn type_input() -> TypeInfo
fn type_input() -> TypeInfo
Source§impl PyTypeInfo for UnitVolume
impl PyTypeInfo for UnitVolume
Source§const NAME: &str = <Self as ::pyo3::PyClass>::NAME
const NAME: &str = <Self as ::pyo3::PyClass>::NAME
prefer using ::type_object(py).name() to get the correct runtime value
Source§const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
const MODULE: Option<&str> = <Self as ::pyo3::impl_::pyclass::PyClassImpl>::MODULE
prefer using ::type_object(py).module() to get the correct runtime value
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Source§impl Serialize for UnitVolume
impl Serialize for UnitVolume
impl StructuralPartialEq for UnitVolume
Source§impl TS for UnitVolume
impl TS for UnitVolume
Source§type WithoutGenerics = UnitVolume
type WithoutGenerics = UnitVolume
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = UnitVolume
type OptionInnerType = UnitVolume
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read moreSource§fn export_to_string(cfg: &Config) -> Result<String, ExportError>where
Self: 'static,
fn export_to_string(cfg: &Config) -> Result<String, ExportError>where
Self: 'static,
Auto Trait Implementations§
impl Freeze for UnitVolume
impl RefUnwindSafe for UnitVolume
impl Send for UnitVolume
impl Sync for UnitVolume
impl Unpin for UnitVolume
impl UnsafeUnpin for UnitVolume
impl UnwindSafe for UnitVolume
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<'py, T> FromPyObjectOwned<'py> for Twhere
T: for<'a> FromPyObject<'a, 'py>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.