Struct kotlin_poet_rs::spec::Package
source · 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)