Skip to content

Why is ser std gated?Β #1281

@jbis9051

Description

@jbis9051

I need canonical JSON support in a no_std but alloc environment.

From evik42/serde-json-canonicalizer#4:

serde_json does not expose the Serializer and Formatter traits in a no_std build

It seems these are in the ser module

pub struct Serializer<W, F = CompactFormatter> {

json/src/ser.rs

Line 1541 in d12e943

pub trait Formatter {

But

json/src/lib.rs

Lines 422 to 426 in d12e943

#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub mod ser;
#[cfg(not(feature = "std"))]
mod ser;

ser appears to still be compiled in no_std environments, just not public.

Why is this? What is preventing ser and more specifically Serializer and Formatter from being public in no_std environments?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions