Struct sbd::information_element::InformationElement
[−]
[src]
pub struct InformationElement { // some fields omitted }
An information element, or IE.
These are the building blocks of a SBD message. There are several types, generally divided into MO and MT IE's. This general structure just holds the basic IE data, when then can be converted into a specific type of IE.
Methods
impl InformationElement
[src]
fn read_from<R: Read>(readable: R) -> Result<InformationElement>
Reads an information element from something that implements Read
.
Examples
use std::io::{Read, Seek, SeekFrom}; use std::fs::File; use sbd::information_element::InformationElement; let mut file = File::open("data/0-mo.sbd").unwrap(); file.seek(SeekFrom::Start(3)).unwrap(); let readable = file.take(31); InformationElement::read_from(readable).unwrap();
fn len(&self) -> u16
Returns the length of the information element.
This is not the same as the internal length, but is rather the length of the contents plus the length of the IE header.
Examples
let information_element = InformationElement::read_from(readable).unwrap(); assert_eq!(31, information_element.len());
fn id(&self) -> u8
Returns the id of the information element.
fn as_contents_reader<'a>(&self) -> Cursor<&[u8]>
Returns a object that can Read
over the contents of this information element.
Examples
let information_element = InformationElement::read_from(readable).unwrap(); let mut readable = information_element.as_contents_reader(); let mut buffer: Vec<u8> = Vec::new(); readable.read_to_end(&mut buffer);
fn contents_ref(&self) -> &Vec<u8>
Return a reference to this information elements contents.
fn into_contents(self) -> Vec<u8>
Convert this information element into its contents.
This consumes the information element.
Trait Implementations
impl Default for InformationElement
[src]
fn default() -> InformationElement
Returns the "default value" for a type. Read more