pub trait ScalarTruncation: Send + Sized {
// Required methods
fn from_scalar(value: Scalar) -> VortexResult<Option<Self>>;
fn len(&self) -> usize;
fn into_scalar(self, nullability: Nullability) -> Scalar;
fn upper_bound(self, max_length: usize) -> Option<Self>;
fn lower_bound(self, max_length: usize) -> Self;
}Expand description
A trait for truncating Scalars to a given length in bytes.
Required Methods§
Sourcefn from_scalar(value: Scalar) -> VortexResult<Option<Self>>
fn from_scalar(value: Scalar) -> VortexResult<Option<Self>>
Unwrap a Scalar into a ScalarTruncation object
§Errors
If the scalar doesn’t match the truncations dtype.
Sourcefn into_scalar(self, nullability: Nullability) -> Scalar
fn into_scalar(self, nullability: Nullability) -> Scalar
Convert the value into a Scalar with the given nullability.
Sourcefn upper_bound(self, max_length: usize) -> Option<Self>
fn upper_bound(self, max_length: usize) -> Option<Self>
Constructs the next Scalar at most max_length bytes that’s lexicographically greater
than this.
Returns None if the value is null or if constructing a greater value would overflow.
Sourcefn lower_bound(self, max_length: usize) -> Self
fn lower_bound(self, max_length: usize) -> Self
Construct a ByteBuffer at most max_length in size that’s less than or equal to
ourselves.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl ScalarTruncation for BufferString
impl ScalarTruncation for BufferString
Source§fn upper_bound(self, max_length: usize) -> Option<Self>
fn upper_bound(self, max_length: usize) -> Option<Self>
Constructs the next BufferString at most max_length bytes that’s lexicographically greater
than this.
Returns None if the value is null or if constructing a greater value would overflow.
Source§fn lower_bound(self, max_length: usize) -> Self
fn lower_bound(self, max_length: usize) -> Self
Construct a BufferString at most max_length in size that’s less than or equal to
ourselves.