GitXplorerGitXplorer
s

serde-scale

public
3 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
b49809549c6b0c6bb612274ab5126d354fa34e04

Bump versions

sstephaneyfx committed 4 years ago
Unverified
979e6fb577fc6da845ec8a9a5cdcf6486ebbcdf8

Explain how to stop proc-macro features from affecting normal dependency features

sstephaneyfx committed 4 years ago
Unverified
a7cb2a7b2fdc98d80a661b65c4f96d1f96eee57f

Ensure VoidError always implements the error trait serde expects

sstephaneyfx committed 4 years ago
Unverified
a6d8eb8019314118bcab9cf4fc35ecaf08867897

Bump version

sstephaneyfx committed 4 years ago
Unverified
001252a39b2211efb647402e3938ff9fb1827387

Trade std's Error proper support for build robustness

sstephaneyfx committed 4 years ago
Unverified
6ce3ffdac0f378b668fa2647c0ead74d20facfec

Implement serializer and deserializer

sstephaneyfx committed 4 years ago

README

The README file for this repository.

Overview

Serializer and deserializer for the SCALE encoding based on serde.

Example

use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, PartialEq, Serialize)]
struct Point {
    x: i8,
    y: i8,
}

let point = Point { x: 3, y: 4 };
let deserialized = serde_scale::from_slice(&serde_scale::to_vec(&point).unwrap()).unwrap();
assert_eq!(point, deserialized);

Conformance

Option<bool> is serialized as a single byte according to the SCALE encoding.

Features

no_std is supported by disabling default features.

  • std: Support for std. It is enabled by default.
  • alloc: Support for the alloc crate.

🔖 Features enabled in build dependencies and proc-macros are also enabled for normal dependencies, which may cause serde to have its std feature on when it is not desired. Nightly cargo prevents this from happening with -Z features=host_dep or the following in .cargo/config:

[unstable]
features = ["host_dep"]

For example, this issue arises when depending on parity-scale-codec-derive.

Test

Most tests live in the serde-scale-tests crate (part of the workspace) in order to avoid dependencies enabling serde features.

cargo test --workspace

Contribute

All contributions shall be licensed under the zlib license.

Related projects

parity-scale-codec: Reference Rust implementation