pub struct Package { /* private fields */ }
Expand description
Fully qualified package name, may be parsed from &str
§Examples
§Parse from string
use std::str::FromStr;
use kotlin_poet_rs::io::RenderKotlin;
use kotlin_poet_rs::spec::Package;
let package = Package::from_str("io.github.lexadiky").unwrap();
assert_eq!(
package.render_string(),
"io.github.lexadiky"
);
§Create from Vec
use std::str::FromStr;
use kotlin_poet_rs::io::RenderKotlin;
use kotlin_poet_rs::spec::{Name, Package};
let package = Package::from(vec![
Name::from("io"),
Name::from("github"),
Name::from("lexadiky"),
]);
assert_eq!(
package.render_string(),
"io.github.lexadiky"
);
§Create root
use std::str::FromStr;
use kotlin_poet_rs::io::RenderKotlin;
use kotlin_poet_rs::spec::{Name, Package};
let package = Package::root();
assert_eq!(
package.render_string(),
""
);
Implementations§
Trait Implementations§
Source§impl RenderKotlin for Package
impl RenderKotlin for Package
Source§fn render_string(&self) -> String
fn render_string(&self) -> String
Shortcut method for converting RenderKotlin::render_into output into String.
impl StructuralPartialEq for Package
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnwindSafe for Package
Blanket Implementations§
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