Skip to main content

ScalarTruncation

Trait ScalarTruncation 

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

Source

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.

Source

fn len(&self) -> usize

The length of the value in bytes.

Source

fn into_scalar(self, nullability: Nullability) -> Scalar

Convert the value into a Scalar with the given nullability.

Source

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.

Source

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

Source§

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

Construct a BufferString at most max_length in size that’s less than or equal to ourselves.

Source§

fn from_scalar(value: Scalar) -> VortexResult<Option<Self>>

Source§

fn len(&self) -> usize

Source§

fn into_scalar(self, nullability: Nullability) -> Scalar

Source§

impl ScalarTruncation for ByteBuffer

Source§

fn from_scalar(value: Scalar) -> VortexResult<Option<Self>>

Source§

fn len(&self) -> usize

Source§

fn into_scalar(self, nullability: Nullability) -> Scalar

Source§

fn upper_bound(self, max_length: usize) -> Option<Self>

Source§

fn lower_bound(self, max_length: usize) -> Self

Implementors§