Skip to main content

IntoValue

Trait IntoValue 

Source
pub trait IntoValue {
    // Required method
    fn into_value(self) -> Value;
}
Expand description

Convert a host value into a Value. Used by the ctx! macro to accept strings, integers, and slices without requiring the caller to wrap each in a Value::* constructor.

This trait is intentionally narrow: impls are shipped for the common host types and third-party extension is not expected. For bespoke types, convert to a supported primitive first (e.g. via Display) or use the longer form Value::String("...".into()).

Numeric conversion: i8..i64, u8..u32, and isize go through an infallible as i64 cast (their full range fits). u64 and usize use a saturating TryFrom conversion — values above i64::MAX clamp to i64::MAX rather than wrapping to a negative. If you need the raw bit pattern, construct a Value::Number(v as i64) explicitly.

Required Methods§

Implementations on Foreign Types§

Source§

impl IntoValue for &str

Source§

impl IntoValue for &String

Source§

impl IntoValue for bool

Source§

impl IntoValue for i8

Source§

impl IntoValue for i16

Source§

impl IntoValue for i32

Source§

impl IntoValue for i64

Source§

impl IntoValue for isize

Source§

impl IntoValue for u8

Source§

impl IntoValue for u16

Source§

impl IntoValue for u32

Source§

impl IntoValue for u64

Source§

impl IntoValue for usize

Source§

impl IntoValue for String

Source§

impl IntoValue for Vec<&str>

Source§

impl IntoValue for Vec<String>

Source§

impl<const N: usize> IntoValue for [&str; N]

Source§

impl<const N: usize> IntoValue for [String; N]

Implementors§