Skip to main content

Json

Struct Json 

Source
pub struct Json(/* private fields */);

Implementations§

Source§

impl Json

Source

pub fn parse(input: &[u8]) -> Result<Self, JsonError>

Source

pub fn parse_reader<R: Read>( reader: &mut R, reactor: Option<&mut dyn Reactor>, ) -> Result<Self, JsonError>

Source§

impl Json

Source

pub fn check_schema(&self, schema: &Json, errors: &mut Vec<JsonMessage>) -> bool

Check this value against a qpdf JSON schema with no flags.

Source

pub fn check_schema_with_flags( &self, schema: &Json, flags: SchemaFlags, errors: &mut Vec<JsonMessage>, ) -> bool

Check this value against a qpdf JSON schema.

Source§

impl Json

Source

pub const LATEST: i32 = 2

Source

pub fn make_dictionary() -> Self

Source

pub fn add_dictionary_member( &self, key: impl AsRef<[u8]>, value: Json, ) -> Result<Json, JsonError>

Source

pub fn make_array() -> Self

Source

pub fn add_array_element(&self, value: Json) -> Result<Json, JsonError>

Source

pub fn make_string(value: impl AsRef<[u8]>) -> Self

Source

pub fn make_int(value: i64) -> Self

Source

pub fn make_real(value: f64) -> Self

Source

pub fn make_number(encoded: impl AsRef<[u8]>) -> Self

Source

pub fn make_bool(value: bool) -> Self

Source

pub fn make_null() -> Self

Source

pub fn make_blob( callback: impl Fn(&mut dyn Pipeline) -> PipelineResult<()> + 'static, ) -> Self

Source

pub fn is_array(&self) -> bool

Source

pub fn is_dictionary(&self) -> bool

Source

pub fn check_dictionary_key_seen( &self, key: impl AsRef<[u8]>, ) -> Result<bool, JsonError>

Source

pub fn get_string(&self) -> Option<Vec<u8>>

Source

pub fn get_number(&self) -> Option<Vec<u8>>

Source

pub fn get_bool(&self) -> Option<bool>

Source

pub fn is_null(&self) -> bool

Source

pub fn get_dict_item(&self, encoded_key: impl AsRef<[u8]>) -> Json

Source

pub fn for_each_dict_item(&self, callback: impl FnMut(&[u8], Json)) -> bool

Source

pub fn for_each_array_item(&self, callback: impl FnMut(Json)) -> bool

Source

pub fn set_start(&self, start: i64)

Source

pub fn set_end(&self, end: i64)

Source

pub fn start(&self) -> i64

Source

pub fn end(&self) -> i64

Source§

impl Json

Source

pub fn write_dictionary_open( out: &mut dyn Pipeline, first: &mut bool, _depth: usize, ) -> PipelineResult<()>

Source

pub fn write_array_open( out: &mut dyn Pipeline, first: &mut bool, _depth: usize, ) -> PipelineResult<()>

Source

pub fn write_dictionary_close( out: &mut dyn Pipeline, first: bool, depth: usize, ) -> PipelineResult<()>

Source

pub fn write_array_close( out: &mut dyn Pipeline, first: bool, depth: usize, ) -> PipelineResult<()>

Source

pub fn write_dictionary_item( out: &mut dyn Pipeline, first: &mut bool, key: &[u8], value: &Json, depth: usize, ) -> PipelineResult<()>

Source

pub fn write_dictionary_key( out: &mut dyn Pipeline, first: &mut bool, encoded_key: &[u8], depth: usize, ) -> PipelineResult<()>

Source

pub fn write_array_item( out: &mut dyn Pipeline, first: &mut bool, value: &Json, depth: usize, ) -> PipelineResult<()>

Source

pub fn write_next( out: &mut dyn Pipeline, first: &mut bool, depth: usize, ) -> PipelineResult<()>

Source

pub fn write(&self, out: &mut dyn Pipeline, depth: usize) -> PipelineResult<()>

Source

pub fn unparse(&self) -> PipelineResult<Vec<u8>>

Trait Implementations§

Source§

impl Clone for Json

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Json

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Json

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Json

§

impl !Send for Json

§

impl !Sync for Json

§

impl !UnwindSafe for Json

§

impl Freeze for Json

§

impl Unpin for Json

§

impl UnsafeUnpin for Json

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.