Struct kotlin_poet_rs::spec::ClassLikeType
source · pub struct ClassLikeType { /* private fields */ }
Expand description
Represents a class like type, such as a class, interface, or enum. This type can be nullable and can have generic arguments and nullability mark.
§Examples
use std::str::FromStr;
use kotlin_poet_rs::io::RenderKotlin;
use kotlin_poet_rs::spec::{ClassLikeType, ClassLikeTypeName, Type};
let class_like_type = ClassLikeType::from("io.github.lexadiky.Class<T>?");
assert_eq!(
"io.github.lexadiky.Class<T>?",
class_like_type.render_string()
);
assert_eq!(
ClassLikeType::new(
ClassLikeTypeName::from("io.github.lexadiky.Class")
).generic_argument(Type::generic("T"))
.nullable(true),
class_like_type
)
Implementations§
source§impl ClassLikeType
impl ClassLikeType
pub fn new<ClassLikeTypeNameLike: Into<ClassLikeTypeName>>( type_name: ClassLikeTypeNameLike, ) -> ClassLikeType
sourcepub fn nullable(self, flag: bool) -> ClassLikeType
pub fn nullable(self, flag: bool) -> ClassLikeType
Marks the type as nullable
sourcepub fn generic_argument<TypeLike: Into<Type>>(
self,
parameter: TypeLike,
) -> ClassLikeType
pub fn generic_argument<TypeLike: Into<Type>>( self, parameter: TypeLike, ) -> ClassLikeType
Adds a generic argument to the type
Trait Implementations§
source§impl Clone for ClassLikeType
impl Clone for ClassLikeType
source§fn clone(&self) -> ClassLikeType
fn clone(&self) -> ClassLikeType
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 ClassLikeType
impl Debug for ClassLikeType
source§impl From<&str> for ClassLikeType
impl From<&str> for ClassLikeType
source§impl From<ClassLikeType> for Type
impl From<ClassLikeType> for Type
source§fn from(value: ClassLikeType) -> Self
fn from(value: ClassLikeType) -> Self
Converts to this type from the input type.
source§impl FromStr for ClassLikeType
impl FromStr for ClassLikeType
source§impl PartialEq for ClassLikeType
impl PartialEq for ClassLikeType
source§impl RenderKotlin for ClassLikeType
impl RenderKotlin for ClassLikeType
source§fn render_string(&self) -> String
fn render_string(&self) -> String
Shortcut method for converting RenderKotlin::render_into output into String.
impl StructuralPartialEq for ClassLikeType
Auto Trait Implementations§
impl Freeze for ClassLikeType
impl RefUnwindSafe for ClassLikeType
impl Send for ClassLikeType
impl Sync for ClassLikeType
impl Unpin for ClassLikeType
impl UnwindSafe for ClassLikeType
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
)