Macro soroban_sdk::symbol

source ·
symbol!() { /* proc-macro */ }
Expand description

Create a Symbol with the given string.

A symbol’s maximum length is 10 characters.

Valid characters are a-zA-Z0-9_.

The Symbol is generated at compile time and returned as a const.

Examples

use soroban_sdk::{symbol, Symbol};

let symbol = symbol!("a_str");
assert_eq!(symbol, Symbol::from_str("a_str"));
use soroban_sdk::{symbol, Symbol};

const symbol: Symbol = symbol!("a_str");
assert_eq!(symbol, Symbol::from_str("a_str"));