Skip to main content

Keyed

Struct Keyed 

Source
pub struct Keyed {
    pub keying: Keying,
    pub last_read: Option<Vec<u8>>,
    /* private fields */
}
Expand description

An indexed or relative file, or a sequential file opened I-O, held in memory from OPEN to CLOSE. The DD holds the records in key (or record-number) order, as an IDCAMS REPRO unload of a KSDS or RRDS does, and CLOSE writes them back that way when they changed.

Fields§

§keying: Keying§last_read: Option<Vec<u8>>

The key of the record the last statement on the file, a successful READ, returned: what a sequential REWRITE or DELETE acts on.

Implementations§

Source§

impl Keyed

Source

pub fn prime_key(&self, record: &[u8]) -> Option<Vec<u8>>

Source

pub fn highest_key(&self) -> Option<&Vec<u8>>

Source

pub fn record(&self, key: &[u8]) -> Option<&Vec<u8>>

Source

pub fn get(&self, which: usize, value: &[u8]) -> Option<Found>

The record whose key which is value: for an alternate key, the first of any duplicates.

Source

pub fn insert( &mut self, key: Vec<u8>, record: Vec<u8>, ) -> Result<bool, &'static str>

Adds a record: Err with status 22 when its prime key, or a unique alternate key, is already there; Ok(true) when it shares an alternate key that allows duplicates (status 02).

Source

pub fn replace( &mut self, key: Vec<u8>, record: Vec<u8>, ) -> Result<bool, &'static str>

Replaces a record: Err with status 23 when none has its key, 22 as for Keyed::insert.

Source

pub fn remove(&mut self, key: &[u8]) -> Option<Vec<u8>>

Source

pub fn start( &mut self, which: usize, wanted: Ordering, or_equal: bool, value: &[u8], ) -> bool

START: positions at the first record whose key which, compared over the length of value (a longer value is cut to the key’s length), is wanted to value, or equal when or_equal. False, and no position, when there is none.

Source

pub fn lose_position(&mut self)

After a READ that found nothing: READ NEXT has no valid next record.

Source

pub fn read_at(&mut self, which: usize, key: &[u8])

Makes the record just read by key which the one READ NEXT goes on from.

Source

pub fn seek( &self, from: &[u8], inclusive: bool, backward: bool, ) -> Option<(Vec<u8>, Vec<u8>)>

The first record by prime key after from (at it too when inclusive), or before it when backward: what a CICS browse reads, holding its own position rather than the file’s.

Source

pub fn step(&mut self, backward: bool) -> Result<Option<Found>, &'static str>

READ NEXT, or READ PREVIOUS when backward: None at the end, Err(46) with no position.

Auto Trait Implementations§

§

impl Freeze for Keyed

§

impl RefUnwindSafe for Keyed

§

impl Send for Keyed

§

impl Sync for Keyed

§

impl Unpin for Keyed

§

impl UnsafeUnpin for Keyed

§

impl UnwindSafe for Keyed

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.