Type Definition odbc_api::parameter::VarCharBox

source ·
pub type VarCharBox = VarChar<Box<[u8]>>;
Expand description

Parameter type for owned, variable sized character data.

We use Box<[u8]> rather than Vec<u8> as a buffer type since the indicator pointer already has the role of telling us how many bytes in the buffer are part of the payload.

Implementations§

Constructs a ‘missing’ value.

Examples found in repository?
src/into_parameter.rs (line 65)
62
63
64
65
66
67
    fn into_parameter(self) -> Self::Parameter {
        match self {
            Some(str) => str.into_parameter(),
            None => VarCharBox::null(),
        }
    }

Create an owned parameter containing the character data from the passed string.

Examples found in repository?
src/into_parameter.rs (line 55)
54
55
56
    fn into_parameter(self) -> Self::Parameter {
        VarCharBox::from_string(self)
    }

Create a VarChar box from a Vec.

Examples found in repository?
src/parameter/varchar.rs (line 57)
56
57
58
    pub fn from_string(val: String) -> Self {
        Self::from_vec(val.into_bytes())
    }

Trait Implementations§