Enum kicad_parse_gen::Sexp
[−]
[src]
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
[src]
fn new_empty() -> Sexp
: please use Sexp::default()
instead
create an empty symbolic-expression
fn new_string<T>(s: T) -> Sexp where
T: Display,
T: Display,
: please use .into()
instead
create a String type symbolic-expression
fn new_list(v: Vec<Sexp>) -> Sexp
: please use .into()
instead
create a list type symbolic-expression
fn start(name: &str) -> Sexp
create an empty list type symbolic-expression
fn push<T>(&mut self, element: T) where
T: Into<Sexp>,
T: Into<Sexp>,
push an element in a list
fn new_named_list<F>(name: &str, fill: F) -> Sexp where
F: Fn(&mut Vec<Sexp>) -> (),
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,
T: Display,
: please use .into()
instead
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,
T: IntoSexp,
: please use .into()
on a tuple instead
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 take_list(&mut self) -> Result<Vec<Sexp>, Error>
if the expression is a list, take out the list and swap it with Empty
fn take_string(&mut self) -> Result<String, Error>
if the expression is a string, take it out and swap it with Empty
fn from<T>(t: &T) -> Sexp where
T: IntoSexp,
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 an &String
fn s(&self) -> Result<String, Error>
access the symbolic-expression as if it is a String
fn is_string(&self) -> bool
is this expression a string
fn is_list(&self) -> bool
is this expression a list
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>
: please use iteratom::IterAtom::new
instead
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 named_value_s(&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>
: please use iteratom::IterAtom::new
instead
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 Display for Sexp
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Default for Sexp
[src]
impl<'a> From<&'a String> for Sexp
[src]
impl<'a> From<(&'a str, Sexp)> for Sexp
[src]
impl<'a> From<&'a str> for Sexp
[src]
impl<'a, T> From<(&'a str, &'a T)> for Sexp where
T: Display,
[src]
T: Display,
impl PartialEq<Sexp> for Sexp
[src]
fn eq(&self, __arg_0: &Sexp) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Sexp) -> bool
This method tests for !=
.
impl Debug for Sexp
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl Clone for Sexp
[src]
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