pub struct Flags(/* private fields */);Expand description
JSON_* option bits for json_encode, json_decode and json_validate.
PHP passes options as int; Flags::from_php keeps the low 32 bits
like the engine’s (int) cast. Unknown bits are ignored.
Implementations§
Source§impl Flags
impl Flags
Sourcepub const OBJECT_AS_ARRAY: Flags
pub const OBJECT_AS_ARRAY: Flags
JSON_OBJECT_AS_ARRAY (decode): objects become arrays.
Sourcepub const BIGINT_AS_STRING: Flags
pub const BIGINT_AS_STRING: Flags
JSON_BIGINT_AS_STRING (decode): integers beyond i64 stay strings.
Sourcepub const FORCE_OBJECT: Flags
pub const FORCE_OBJECT: Flags
JSON_FORCE_OBJECT: lists as objects.
Sourcepub const NUMERIC_CHECK: Flags
pub const NUMERIC_CHECK: Flags
JSON_NUMERIC_CHECK: numeric strings as numbers.
Sourcepub const UNESCAPED_SLASHES: Flags
pub const UNESCAPED_SLASHES: Flags
JSON_UNESCAPED_SLASHES: / stays /.
Sourcepub const PRETTY_PRINT: Flags
pub const PRETTY_PRINT: Flags
JSON_PRETTY_PRINT: newlines and four-space indentation.
Sourcepub const UNESCAPED_UNICODE: Flags
pub const UNESCAPED_UNICODE: Flags
JSON_UNESCAPED_UNICODE: non-ASCII characters stay raw (except U+2028/U+2029).
Sourcepub const PARTIAL_OUTPUT_ON_ERROR: Flags
pub const PARTIAL_OUTPUT_ON_ERROR: Flags
JSON_PARTIAL_OUTPUT_ON_ERROR: replace what cannot be encoded and keep going.
Sourcepub const PRESERVE_ZERO_FRACTION: Flags
pub const PRESERVE_ZERO_FRACTION: Flags
JSON_PRESERVE_ZERO_FRACTION: 1.0 stays 1.0.
Sourcepub const UNESCAPED_LINE_TERMINATORS: Flags
pub const UNESCAPED_LINE_TERMINATORS: Flags
JSON_UNESCAPED_LINE_TERMINATORS: with UNESCAPED_UNICODE, U+2028/U+2029 stay raw.
Sourcepub const INVALID_UTF8_IGNORE: Flags
pub const INVALID_UTF8_IGNORE: Flags
JSON_INVALID_UTF8_IGNORE: drop invalid UTF-8.
Sourcepub const INVALID_UTF8_SUBSTITUTE: Flags
pub const INVALID_UTF8_SUBSTITUTE: Flags
JSON_INVALID_UTF8_SUBSTITUTE: replace invalid UTF-8 with U+FFFD.
Sourcepub const THROW_ON_ERROR: Flags
pub const THROW_ON_ERROR: Flags
JSON_THROW_ON_ERROR: PHP throws JsonException instead of setting the last error.
Sourcepub const fn from_php(options: i64) -> Flags
pub const fn from_php(options: i64) -> Flags
Options as PHP code passes them (an int, cast like the engine’s (int)).
Sourcepub const fn intersects(self, other: Flags) -> bool
pub const fn intersects(self, other: Flags) -> bool
Whether any bit of other is set.
Trait Implementations§
Source§impl BitOrAssign for Flags
impl BitOrAssign for Flags
Source§fn bitor_assign(&mut self, rhs: Flags)
fn bitor_assign(&mut self, rhs: Flags)
Adds the options of rhs.
impl Copy for Flags
impl Eq for Flags
impl StructuralPartialEq for Flags
Auto Trait Implementations§
impl Forget for Flags
impl Freeze for Flags
impl Move for Flags
impl RefUnwindSafe for Flags
impl Send for Flags
impl Sync for Flags
impl Unpin for Flags
impl UnsafeUnpin for Flags
impl UnwindSafe for Flags
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.