[][src]Trait iso8583_rs::iso8583::field::Field

pub trait Field: Sync {
    fn name(&self) -> &String;
fn parse(
        &self,
        in_buf: &mut dyn BufRead,
        f2d_map: &mut HashMap<String, Vec<u8>>
    ) -> Result<(), ParseError>;
fn assemble(
        &self,
        out_buf: &mut Vec<u8>,
        iso_msg: &IsoMsg
    ) -> Result<u32, ParseError>;
fn position(&self) -> u32;
fn children(&self) -> Vec<&dyn Field>;
fn child_by_pos(&self, pos: u32) -> &dyn Field;
fn child_by_name(&self, name: &String) -> &dyn Field;
fn to_string(&self, data: &Vec<u8>) -> String;
fn to_raw(&self, val: &str) -> Vec<u8>; }

This trait represents a ISO field (specific implementations are FixedField, VarField and BmpField)

Required methods

fn name(&self) -> &String

Returns the name of the field

fn parse(
    &self,
    in_buf: &mut dyn BufRead,
    f2d_map: &mut HashMap<String, Vec<u8>>
) -> Result<(), ParseError>

Parses the field by reading from in_buf and stores the result into f2d_map Returns a ParseError on failure

fn assemble(
    &self,
    out_buf: &mut Vec<u8>,
    iso_msg: &IsoMsg
) -> Result<u32, ParseError>

Assembles the field i.e. appends it data into out_buf Returns the number of bytes written on success or a ParseError on failure

fn position(&self) -> u32

Returns the position of the field in the parent field (mostly applicable for chlidren of BmpField)

fn children(&self) -> Vec<&dyn Field>

Returns children as Vec

fn child_by_pos(&self, pos: u32) -> &dyn Field

Returns the child field by position

fn child_by_name(&self, name: &String) -> &dyn Field

Returns child field by name

fn to_string(&self, data: &Vec<u8>) -> String

Returns a string that represents the field value in ascii

fn to_raw(&self, val: &str) -> Vec<u8>

Returns field value as binary (wire format)

Loading content...

Implementors

impl Field for BmpField[src]

impl Field for FixedField[src]

impl Field for VarField[src]

Loading content...