pub struct Output<const CAPACITY: usize> {
pub bytes: [u8; CAPACITY],
pub length: usize,
}Expand description
Const-evaluable output buffer.
With CAPACITY == 0 nothing is stored and only Output::length advances (the measuring
pass). With CAPACITY > 0 the bytes are written into bytes, which must be exactly the
length the measuring pass reported; anything else is an out-of-bounds const-eval error.
Fields§
§bytes: [u8; CAPACITY]The rendered bytes. Meaningful only when CAPACITY is the measured length.
length: usizeThe number of bytes rendered.
Implementations§
Source§impl<const CAPACITY: usize> Output<CAPACITY>
impl<const CAPACITY: usize> Output<CAPACITY>
Sourcepub const fn put_quoted(&mut self, text: &str)
pub const fn put_quoted(&mut self, text: &str)
Append a string as a double-quoted Javascript literal, escaping backslashes and quotes.
Sourcepub const fn put_ident(&mut self, name: &str)
pub const fn put_ident(&mut self, name: &str)
Append an identifier, adding a trailing underscore if it is a reserved word.
Sourcepub const fn put_quoted_ident(&mut self, name: &str)
pub const fn put_quoted_ident(&mut self, name: &str)
Append an identifier as a quoted string, with the same underscore rule.
Trait Implementations§
Auto Trait Implementations§
impl<const CAPACITY: usize> Freeze for Output<CAPACITY>
impl<const CAPACITY: usize> RefUnwindSafe for Output<CAPACITY>
impl<const CAPACITY: usize> Send for Output<CAPACITY>
impl<const CAPACITY: usize> Sync for Output<CAPACITY>
impl<const CAPACITY: usize> Unpin for Output<CAPACITY>
impl<const CAPACITY: usize> UnsafeUnpin for Output<CAPACITY>
impl<const CAPACITY: usize> UnwindSafe for Output<CAPACITY>
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