snarkvm_console::prelude

Trait Parser

Source
pub trait Parser: Display + FromStr {
    // Required method
    fn parse(string: &str) -> Result<(&str, Self), Err<VerboseError<&str>>>
       where Self: Sized;
}
Expand description

Operations to parse a string literal into an object.

Required Methods§

Source

fn parse(string: &str) -> Result<(&str, Self), Err<VerboseError<&str>>>
where Self: Sized,

Parses a string literal into an object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Parser for LiteralType

Source§

fn parse(string: &str) -> Result<(&str, LiteralType), Err<VerboseError<&str>>>

Parses a string into a literal type.

Source§

impl<E> Parser for Address<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, Address<E>), Err<VerboseError<&str>>>

Parses a string into an address.

Source§

impl<E> Parser for Boolean<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, Boolean<E>), Err<VerboseError<&str>>>

Parses a string into a boolean.

Source§

impl<E> Parser for Field<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, Field<E>), Err<VerboseError<&str>>>

Parses a string into a field circuit.

Source§

impl<E> Parser for Group<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, Group<E>), Err<VerboseError<&str>>>

Parses a string into a group circuit.

Source§

impl<E> Parser for Scalar<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, Scalar<E>), Err<VerboseError<&str>>>

Parses a string into a scalar circuit.

Source§

impl<E> Parser for StringType<E>
where E: Environment,

Source§

fn parse(string: &str) -> Result<(&str, StringType<E>), Err<VerboseError<&str>>>

Parses a string into a string type.

Source§

impl<E, I> Parser for Integer<E, I>
where E: Environment, I: IntegerType,

Source§

fn parse(string: &str) -> Result<(&str, Integer<E, I>), Err<VerboseError<&str>>>

Parses a string into a integer circuit.

Source§

impl<N> Parser for Access<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Access<N>), Err<VerboseError<&str>>>

Source§

impl<N> Parser for Literal<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Literal<N>), Err<VerboseError<&str>>>

Parses a string into a literal.

Source§

impl<N> Parser for Plaintext<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Plaintext<N>), Err<VerboseError<&str>>>

Parses a string into a plaintext value.

Source§

impl<N> Parser for Entry<N, Plaintext<N>>
where N: Network,

Source§

fn parse( string: &str, ) -> Result<(&str, Entry<N, Plaintext<N>>), Err<VerboseError<&str>>>

Parses a string into the entry.

Source§

impl<N> Parser for Register<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Register<N>), Err<VerboseError<&str>>>

Parses a string into a register. The register is of the form r{locator} or r{locator}.{identifier}.

Source§

impl<N> Parser for Value<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Value<N>), Err<VerboseError<&str>>>

Parses a string into a value.

Source§

impl<N> Parser for FinalizeType<N>
where N: Network,

Source§

fn parse( string: &str, ) -> Result<(&str, FinalizeType<N>), Err<VerboseError<&str>>>

Parses a string into a finalize type.

Source§

impl<N> Parser for PlaintextType<N>
where N: Network,

Source§

fn parse( string: &str, ) -> Result<(&str, PlaintextType<N>), Err<VerboseError<&str>>>

Parses a string into a plaintext type.

Source§

impl<N> Parser for EntryType<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, EntryType<N>), Err<VerboseError<&str>>>

Parses a string into the entry type.

Source§

impl<N> Parser for RegisterType<N>
where N: Network,

Source§

fn parse( string: &str, ) -> Result<(&str, RegisterType<N>), Err<VerboseError<&str>>>

Parses a string into a register type.

Source§

impl<N> Parser for ValueType<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, ValueType<N>), Err<VerboseError<&str>>>

Parses the string into a value type.

Source§

impl<N> Parser for Signature<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Signature<N>), Err<VerboseError<&str>>>

Parses a string into an signature.

Source§

impl<N> Parser for Ciphertext<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Ciphertext<N>), Err<VerboseError<&str>>>

Parses a string into an ciphertext.

Source§

impl<N> Parser for Future<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Future<N>), Err<VerboseError<&str>>>

Parses a string into a future value.

Source§

impl<N> Parser for Identifier<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Identifier<N>), Err<VerboseError<&str>>>

Parses a string into an identifier.

§Requirements

The identifier must be alphanumeric (or underscore). The identifier must not start with a number. The identifier must not be a keyword.

Source§

impl<N> Parser for Record<N, Plaintext<N>>
where N: Network,

Source§

fn parse( string: &str, ) -> Result<(&str, Record<N, Plaintext<N>>), Err<VerboseError<&str>>>

Parses a string as a record: { owner: address, identifier_0: entry_0, ..., identifier_n: entry_n, _nonce: field }.

Source§

impl<N> Parser for Record<N, Ciphertext<N>>
where N: Network,

Source§

fn parse( string: &str, ) -> Result<(&str, Record<N, Ciphertext<N>>), Err<VerboseError<&str>>>

Parses a string into an ciphertext.

Source§

impl<N> Parser for ArrayType<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, ArrayType<N>), Err<VerboseError<&str>>>

Parses a string into a literal type.

Source§

impl<N> Parser for RecordType<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, RecordType<N>), Err<VerboseError<&str>>>

Parses a record type as:

  record message:
      owner as address.private;
      user_defined as u64.public;
Source§

impl<N> Parser for StructType<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, StructType<N>), Err<VerboseError<&str>>>

Parses a struct as:

  struct message:
      owner as address;
      amount as u64;
Source§

impl<N> Parser for ProgramID<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, ProgramID<N>), Err<VerboseError<&str>>>

Parses a string into a program ID of the form {name}.{network}.

Source§

impl<N> Parser for Locator<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, Locator<N>), Err<VerboseError<&str>>>

Parses a string into a locator of the form {program_id}/{resource}.

Source§

impl<N> Parser for StatePath<N>
where N: Network,

Source§

fn parse(string: &str) -> Result<(&str, StatePath<N>), Err<VerboseError<&str>>>

Parses a string into the state path.

Implementors§