cell_by_name

Function cell_by_name 

Source
pub fn cell_by_name(name: &str) -> Result<CellType, Error>
Expand description

Looks up a cell type by its protocol name.

Names are case-sensitive and must match the Tor specification exactly (e.g., “PADDING”, “VERSIONS”, “RELAY”).

§Arguments

  • name - The cell type name to look up

§Errors

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

§Example

use stem_rs::client::cell::cell_by_name;

let cell_type = cell_by_name("NETINFO").unwrap();
assert_eq!(cell_type.value(), 8);

assert!(cell_by_name("INVALID").is_err());