Struct kotlin_poet_rs::spec::Argument
source · pub struct Argument { /* private fields */ }
Expand description
Function argument, consists of pair name and value. If name is None is considered as positional argument.
Set of function arguments could is usually represented as Vec
§Examples
§Named argument
use kotlin_poet_rs::spec::{CodeBlock, Name, Argument};
use kotlin_poet_rs::io::RenderKotlin;
let argument = Argument::new_named(
Name::from("name"), CodeBlock::atom("value")
);
assert_eq!(argument.render_string(), "name = value");
§Positional argument
use kotlin_poet_rs::spec::{CodeBlock, Name, Argument};
use kotlin_poet_rs::io::RenderKotlin;
let argument = Argument::new_positional(
CodeBlock::statement("value")
);
assert_eq!(argument.render_string(), "value");
Implementations§
Trait Implementations§
source§impl RenderKotlin for Argument
impl RenderKotlin for Argument
source§fn render_string(&self) -> String
fn render_string(&self) -> String
Shortcut method for converting RenderKotlin::render_into output into String.
Auto Trait Implementations§
impl Freeze for Argument
impl RefUnwindSafe for Argument
impl Send for Argument
impl Sync for Argument
impl Unpin for Argument
impl UnwindSafe for Argument
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
)