Trait ExtFnValueCursor

Source
pub trait ExtFnValueCursor {
    type Item: ?Sized;

    // Required methods
    fn advance(&mut self) -> Result<(), Error>;
    fn get(&self) -> Option<&Self::Item>;
    fn is_null(&self) -> bool;
    fn kind(&self) -> SqlDataTypeKind;
    fn data_type(&self) -> SqlDataType;
    fn len(&self) -> usize;

    // Provided methods
    fn next(&mut self) -> Result<Option<&Self::Item>, Error> { ... }
    fn for_each<F>(self, f: F) -> Result<(), Error>
       where Self: Sized,
             F: FnMut(&Self::Item) { ... }
    fn fold<F, U>(self, init: U, f: F) -> Result<U, Error>
       where Self: Sized,
             F: FnMut(U, &Self::Item) -> U { ... }
    fn collect<U>(self) -> Result<U, Error>
       where Self: Sized,
             U: for<'s> Extend<&'s Self::Item> + Default { ... }
}
Expand description

Cursor of SQL anywhere values that are potentially multipart.

Required Associated Types§

Source

type Item: ?Sized

The type presented by the cursor.

Required Methods§

Source

fn advance(&mut self) -> Result<(), Error>

Advances the cursor to the next value part if available.

Cursors are initially unstarted, so this method should be called before get when iterating.

The behavior of calling this method after get has returned None, or after this method has returned an error is unspecified.

Source

fn get(&self) -> Option<&Self::Item>

Returns the current value part.

The behavior of calling this method before any calls to advance is unspecified.

Source

fn is_null(&self) -> bool

Returns if the data value is NULL

Source

fn kind(&self) -> SqlDataTypeKind

Returns the actual catalog type for the argument

Source

fn data_type(&self) -> SqlDataType

Returns the data type for the argument

Source

fn len(&self) -> usize

Returns the total length for the argument

Provided Methods§

Source

fn next(&mut self) -> Result<Option<&Self::Item>, Error>

Advances the cursor, returning the next value part if available.

Source

fn for_each<F>(self, f: F) -> Result<(), Error>
where Self: Sized, F: FnMut(&Self::Item),

Calls a closure on each element of an iterator.

Source

fn fold<F, U>(self, init: U, f: F) -> Result<U, Error>
where Self: Sized, F: FnMut(U, &Self::Item) -> U,

Consume the cursor, producing a single, final value.

Source

fn collect<U>(self) -> Result<U, Error>
where Self: Sized, U: for<'s> Extend<&'s Self::Item> + Default,

Consume the cursor folding into the given Extend type

Implementations on Foreign Types§

Source§

impl<'a, I> ExtFnValueCursor for &'a mut I
where I: ExtFnValueCursor + ?Sized,

Source§

fn is_null(&self) -> bool

Returns if the data value is NULL

Source§

fn kind(&self) -> SqlDataTypeKind

Returns the actual catalog type for the argument

Source§

fn data_type(&self) -> SqlDataType

Returns the data type for the argument

Source§

fn len(&self) -> usize

Returns the total length for the argument

Source§

type Item = <I as ExtFnValueCursor>::Item

Source§

fn advance(&mut self) -> Result<(), Error>

Source§

fn get(&self) -> Option<&I::Item>

Source§

fn next(&mut self) -> Result<Option<&I::Item>, Error>

Implementors§