Struct icu_provider_fs::export::serializers::json::Serializer
source · pub struct Serializer { /* private fields */ }
Expand description
A serializer for JavaScript Object Notation (JSON).
§Examples
use icu_provider_fs::export::serializers;
use icu_provider_fs::export::FilesystemExporter;
let serializer = serializers::Json::pretty();
// Then pass it to a FilesystemExporter:
let demo_path = std::env::temp_dir().join("icu4x_json_serializer_demo");
FilesystemExporter::try_new(
Box::from(serializer),
demo_path.clone().into(),
)
.unwrap();
Implementations§
source§impl Serializer
impl Serializer
sourcepub fn new(options: Options) -> Self
pub fn new(options: Options) -> Self
Creates a new serializer for serde_json
.
sourcepub fn pretty() -> Self
pub fn pretty() -> Self
Convenience function to create a JSON serializer with the
StyleOption::Pretty
format.
Trait Implementations§
source§impl AbstractSerializer for Serializer
impl AbstractSerializer for Serializer
source§fn serialize(
&self,
obj: &DataPayload<ExportMarker>,
sink: &mut dyn Write
) -> Result<(), DataError>
fn serialize( &self, obj: &DataPayload<ExportMarker>, sink: &mut dyn Write ) -> Result<(), DataError>
Serializes an object to a sink.
source§fn get_buffer_format(&self) -> BufferFormat
fn get_buffer_format(&self) -> BufferFormat
Gets the buffer format currently being serialized.
source§fn is_text_format(&self) -> bool
fn is_text_format(&self) -> bool
This can be set to get correct CRLF on Windows.
source§impl Debug for Serializer
impl Debug for Serializer
source§impl Default for Serializer
impl Default for Serializer
source§fn default() -> Serializer
fn default() -> Serializer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Serializer
impl RefUnwindSafe for Serializer
impl Send for Serializer
impl Sync for Serializer
impl Unpin for Serializer
impl UnwindSafe for Serializer
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