pub struct Never<T = ()>(/* private fields */);Expand description
Cast a Rust type to a Typescript never type.
§Examples
This can be used as a type override.
use serde::Serialize;
use specta::Type;
use specta_typescript::Never;
#[derive(Serialize, Type)]
pub struct Demo {
#[specta(type = Never)]
pub field: String,
}Or it can be used as a wrapper type.
use serde::Serialize;
use specta::Type;
use specta_typescript::Never;
#[derive(Serialize, Type)]
pub struct Demo {
pub field: Never<String>,
}Trait Implementations§
Source§impl<T> Type for Never<T>
impl<T> Type for Never<T>
Source§fn definition(_: &mut TypeCollection) -> DataType
fn definition(_: &mut TypeCollection) -> DataType
returns a
DataType that represents the type.
This will also register this and any dependent types into the TypeCollection.Auto Trait Implementations§
impl<T> Freeze for Never<T>where
T: Freeze,
impl<T> RefUnwindSafe for Never<T>where
T: RefUnwindSafe,
impl<T> Send for Never<T>where
T: Send,
impl<T> Sync for Never<T>where
T: Sync,
impl<T> Unpin for Never<T>where
T: Unpin,
impl<T> UnsafeUnpin for Never<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Never<T>where
T: UnwindSafe,
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