Skip to main content

ArrayBuilder

Struct ArrayBuilder 

Source
pub struct ArrayBuilder { /* private fields */ }
Expand description

Builder for constructing JSON arrays with a fluent API

Implementations§

Source§

impl ArrayBuilder

Source

pub fn new() -> Self

Creates a new empty array builder

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a builder with pre-allocated capacity

Source

pub fn push_str(self, value: &str) -> Self

Pushes a string element

Source

pub fn add_str(self, value: &str) -> Self

Alias for push_str

Source

pub fn push_i32(self, value: i32) -> Self

Pushes an i32 element

Source

pub fn add_i32(self, value: i32) -> Self

Alias for push_i32

Source

pub fn push_f64(self, value: f64) -> Self

Pushes an f64 element

Source

pub fn add_f64(self, value: f64) -> Self

Alias for push_f64

Source

pub fn push_bool(self, value: bool) -> Self

Pushes a boolean element

Source

pub fn add_bool(self, value: bool) -> Self

Alias for push_bool

Source

pub fn push_null(self) -> Self

Pushes a null element

Source

pub fn add_null(self) -> Self

Alias for push_null

Source

pub fn push_node(self, node: Node) -> Self

Pushes a Node element

Source

pub fn add_node(self, node: Node) -> Self

Alias for push_node

Source

pub fn build(self) -> Node

Builds the final Node::Array

Trait Implementations§

Source§

impl Default for ArrayBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.