pub struct BigInt<T = ()>(/* private fields */);Expand description
Cast a Rust type to a Typescript bigint type.
This can be used to opt into exporting BigInt-style Rust integer types as
Typescript bigint when your runtime supports lossless bigint transport.
§Examples
This can be used as a type override.
use serde::Serialize;
use specta::Type;
use specta_typescript::BigInt;
#[derive(Serialize, Type)]
pub struct Demo {
#[specta(type = BigInt)]
pub field: i128,
}Or it can be used as a wrapper type.
use serde::Serialize;
use specta::Type;
use specta_typescript::BigInt;
#[derive(Serialize, Type)]
pub struct Demo {
pub field: BigInt<i128>,
}Trait Implementations§
Source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for BigInt<T>
Available on crate feature serde only.
impl<'de, T: Deserialize<'de>> Deserialize<'de> for BigInt<T>
Available on crate feature
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for BigInt<T>where
T: Freeze,
impl<T> RefUnwindSafe for BigInt<T>where
T: RefUnwindSafe,
impl<T> Send for BigInt<T>where
T: Send,
impl<T> Sync for BigInt<T>where
T: Sync,
impl<T> Unpin for BigInt<T>where
T: Unpin,
impl<T> UnsafeUnpin for BigInt<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for BigInt<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