Enum kicad_parse_gen::Sexp []

pub enum Sexp {
    String(String),
    List(Vec<Sexp>),
    Empty,
}

a symbolic-expression Can be a string or a list or nothing

Variants

String(String)

plain String symbolic-expression

List(Vec<Sexp>)

list symbolic-expression

Empty

empty, trivial symbolic-expression

Methods

impl Sexp

fn new_empty() -> Sexp

create an empty symbolic-expression

fn new_string<T>(s: T) -> Sexp where T: Display

create a String type symbolic-expression

fn new_list(v: Vec<Sexp>) -> Sexp

create a list type symbolic-expression

fn new_named_list<F>(name: &str, fill: F) -> Sexp where F: Fn(&mut Vec<Sexp>) -> ()

create a list type symbolic-expression where the first element of the list is a string that indicates the name, the remainder is filled in via the provided fill function

fn new_named<T>(name: &str, value: T) -> Sexp where T: Display

create a list type symbolic-expression where the first element of the list is a string that indicates the name

fn new_named_sexp<T>(name: &str, value: &T) -> Sexp where T: IntoSexp

create a list type symbolic-expression where the first element of the list is a string that indicates the name, and the second is another symbolic-expression created via the IntoSexp trait

fn from<T>(t: &T) -> Sexp where T: IntoSexp

create a symbolic-expression via the IntoSexp trait

fn list(&self) -> Result<&Vec<Sexp>, Error>

access the symbolic-expression as if it is a List

fn string(&self) -> Result<&String, Error>

access the symbolic-expression as if it is a String

fn f(&self) -> Result<f64, Error>

access the symbolic-expression as if it is a String that is a f64

fn i(&self) -> Result<i64, Error>

access the symbolic-expression as if it is a String that is an i64

fn list_name(&self) -> Result<&String, Error>

access the symbolic-expression as if it is a List assuming the first element is a String and return that

fn slice_atom(&self, s: &str) -> Result<&[Sexp], Error>

access the symbolic-expression as if it is a named List where the name is provided and returns the remaining elements after the name as a slice

fn named_value(&self, s: &str) -> Result<&Sexp, Error>

access the symbolic-expression as if it is a named List with two elements where the name is provided and returns the next element in the list

fn named_value_i(&self, s: &str) -> Result<i64, Error>

as named_value but converted to i64

fn named_value_f(&self, s: &str) -> Result<f64, Error>

as named_value but converted to f64

fn named_value_string(&self, s: &str) -> Result<&String, Error>

as named_value but converted to String

fn slice_atom_num(&self, s: &str, num: usize) -> Result<&[Sexp], Error>

get the symbolic-expression as a list which starts with a string that indicates the name and has num more elements, returns those elements

Trait Implementations

impl Clone for Sexp

fn clone(&self) -> Sexp

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Debug for Sexp

fn fmt(&self, __arg_0: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.

impl Display for Sexp

fn fmt(&self, f: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.