pub struct Path {
pub segments: Vec<PathSegment>,
}Fields§
§segments: Vec<PathSegment>Implementations§
source§impl Path
impl Path
pub fn new(segments: Vec<PathSegment>) -> Self
sourcepub fn single(ident: impl Into<PathSegment>) -> Self
pub fn single(ident: impl Into<PathSegment>) -> Self
Examples found in repository?
examples/hello.rs (line 7)
1 2 3 4 5 6 7 8 9 10 11 12 13
fn main() -> Result<(), Box<dyn std::error::Error>> {
use ruast::*;
let mut krate = Crate::new();
let def = Fn::main(
None,
Block::from(Path::single("println").mac_call(vec![Token::lit("Hello, world!")])),
);
krate.add_item(def);
println!("{krate}");
// krate.dump("hello.rs")?;
Ok(())
}pub fn chain(self, ident: impl Into<PathSegment>) -> Self
sourcepub fn mac_call(self, args: impl Into<DelimArgs>) -> MacCall
pub fn mac_call(self, args: impl Into<DelimArgs>) -> MacCall
Examples found in repository?
examples/hello.rs (line 7)
1 2 3 4 5 6 7 8 9 10 11 12 13
fn main() -> Result<(), Box<dyn std::error::Error>> {
use ruast::*;
let mut krate = Crate::new();
let def = Fn::main(
None,
Block::from(Path::single("println").mac_call(vec![Token::lit("Hello, world!")])),
);
krate.add_item(def);
println!("{krate}");
// krate.dump("hello.rs")?;
Ok(())
}pub fn struct_(self, fields: Vec<ExprField>) -> Struct
pub fn use_(self) -> Use
Trait Implementations§
source§impl From<Path> for TokenStream
impl From<Path> for TokenStream
source§impl PartialEq for Path
impl PartialEq for Path
impl Eq for Path
impl StructuralEq for Path
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
Blanket Implementations§
source§impl<E> Accessible for Ewhere
E: Into<Expr>,
impl<E> Accessible for Ewhere E: Into<Expr>,
source§impl<E> Assignable for Ewhere
E: Into<Expr>,
impl<E> Assignable for Ewhere E: Into<Expr>,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more