pub enum VarWidth {
Numeric,
String(u16),
}Expand description
A variable’s width.
This is essentially VarType plus a width for VarType::String.
Variants§
Implementations§
Source§impl VarWidth
impl VarWidth
pub const MAX_STRING: u16 = 32767
Sourcepub const SEGMENT_SIZE: usize = 252
pub const SEGMENT_SIZE: usize = 252
Number of bytes per segment by which the amount of space for very long string variables is allocated.
pub fn n_dict_indexes(self) -> usize
Sourcepub fn wider(a: VarWidth, b: VarWidth) -> Option<VarWidth>
pub fn wider(a: VarWidth, b: VarWidth) -> Option<VarWidth>
Returns the wider of self and other:
- Numerical variable widths are equally wide.
- Longer strings are wider than shorter strings.
- Numerical and string types are incomparable, so result in
None.
Sourcepub fn narrower(a: VarWidth, b: VarWidth) -> Option<VarWidth>
pub fn narrower(a: VarWidth, b: VarWidth) -> Option<VarWidth>
Returns the narrower of self and other (see Self::wider).
pub fn default_display_width(&self) -> u32
pub fn is_long_string(&self) -> bool
pub fn as_string_width(&self) -> Option<usize>
pub fn is_numeric(&self) -> bool
pub fn is_string(&self) -> bool
Sourcepub fn is_very_long_string(&self) -> bool
pub fn is_very_long_string(&self) -> bool
Returns true if this is a very long string width, meaning wider than 255 bytes, which was the limit for old versions of SPSS.
Sourcepub fn segments(&self) -> Segments ⓘ
pub fn segments(&self) -> Segments ⓘ
Returns an iterator over the “segments” used for writing case data for a variable with this width. A segment is a physical variable in the system file that represents some piece of a logical variable as seen by a PSPP user. Most variables have one segment whose width is their own width, but very long string variables, with width greater than 255, have multiple segments each with width 255 or less.
Sourcepub fn n_chunks(&self) -> Option<usize>
pub fn n_chunks(&self) -> Option<usize>
Returns the number of 8-byte chunks used for writing case data for a variable with this width. Very long string variables (wider than 255 bytes) cannot directly be divided into chunks: they must first be divided into multiple segments, which can then be divided into chunks.
Sourcepub fn segment_alloc_width(&self, segment_idx: usize) -> usize
pub fn segment_alloc_width(&self, segment_idx: usize) -> usize
Returns the width to allocate to the segment with the given
segment_idx within this variable. A segment is a physical variable in
the system file that represents some piece of a logical variable as seen
by a PSPP user.
pub fn display_adjective(&self) -> VarWidthAdjective
pub fn codepage_to_unicode(&mut self)
Trait Implementations§
impl Copy for VarWidth
impl Eq for VarWidth
Source§impl Ord for VarWidth
impl Ord for VarWidth
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for VarWidth
impl PartialOrd for VarWidth
impl StructuralPartialEq for VarWidth
Auto Trait Implementations§
impl Freeze for VarWidth
impl RefUnwindSafe for VarWidth
impl Send for VarWidth
impl Sync for VarWidth
impl Unpin for VarWidth
impl UnsafeUnpin for VarWidth
impl UnwindSafe for VarWidth
Blanket Implementations§
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
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<D> IdType for D
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 more