cell_by_value

Function cell_by_value 

Source
pub fn cell_by_value(value: u8) -> Result<CellType, Error>
Expand description

Looks up a cell type by its numeric command value.

Values 0-127 are fixed-size cells, 128+ are variable-size cells.

§Arguments

  • value - The cell command value to look up

§Errors

Returns Error::Protocol if the value is not a valid cell type.

§Example

use stem_rs::client::cell::cell_by_value;

let cell_type = cell_by_value(8).unwrap();
assert_eq!(cell_type.name(), "NETINFO");

assert!(cell_by_value(255).is_err());