Struct kotlin_poet_rs::spec::KotlinFile
source · pub struct KotlinFile { /* private fields */ }
Expand description
Represents a Kotlin file.
Implementations§
source§impl KotlinFile
impl KotlinFile
sourcepub fn new<PackageLike: Into<Package>>(package: PackageLike) -> Self
pub fn new<PackageLike: Into<Package>>(package: PackageLike) -> Self
Creates file in specified [package]
sourcepub fn header_comment<CommentLike: Into<Comment>>(
self,
comment: CommentLike,
) -> Self
pub fn header_comment<CommentLike: Into<Comment>>( self, comment: CommentLike, ) -> Self
Adds new comment in first line.
This method can be called multiple times to add multiple comments, they will appear in order on enw lines.
sourcepub fn type_alias(self, type_alias: TypeAlias) -> Self
pub fn type_alias(self, type_alias: TypeAlias) -> Self
Adds new type alias to the file.
sourcepub fn annotation(self, annotation: Annotation) -> Self
pub fn annotation(self, annotation: Annotation) -> Self
Adds new annotation to the file. Added annotation will be forced to have AnnotationTarget::File target.
Trait Implementations§
source§impl Clone for KotlinFile
impl Clone for KotlinFile
source§fn clone(&self) -> KotlinFile
fn clone(&self) -> KotlinFile
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for KotlinFile
impl Debug for KotlinFile
source§impl From<ClassLikeTypeName> for KotlinFile
impl From<ClassLikeTypeName> for KotlinFile
source§fn from(value: ClassLikeTypeName) -> Self
fn from(value: ClassLikeTypeName) -> Self
Converts to this type from the input type.
source§impl RenderKotlin for KotlinFile
impl RenderKotlin for KotlinFile
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 KotlinFile
impl RefUnwindSafe for KotlinFile
impl Send for KotlinFile
impl Sync for KotlinFile
impl Unpin for KotlinFile
impl UnwindSafe for KotlinFile
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
)