Skip to content
This repository was archived by the owner on Aug 15, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e0ae01f
Initial update
Firstyear Sep 16, 2022
dcf6bec
Add CI workflows
robjtede Jan 2, 2023
39c5820
Merge pull request #2 from kanidm/ci
robjtede Jan 2, 2023
30bb930
address clippy lints
robjtede Sep 28, 2022
f37f125
Add MSRV checks to CI
robjtede Jan 2, 2023
18672c1
Address remaining clippy lints
robjtede Jan 2, 2023
ac218c5
Merge pull request #1 from kanidm/clippy
robjtede Jan 2, 2023
61bac46
Remove extern crate declarations
robjtede Jan 2, 2023
8cc5709
Add no_std CI checks
robjtede Jan 2, 2023
ad9308d
Merge pull request #3 from kanidm/rm-extern
robjtede Jan 2, 2023
b7fd708
Address remaining clippy lints in feature flagged areas
robjtede Jan 2, 2023
ab3296b
Run CI on main branch
robjtede Jan 2, 2023
36d5ca9
chore: bump MSRV to 1.70
robjtede Sep 12, 2023
85ade13
ci: add dependabot config for GHA
robjtede Sep 12, 2023
09a8a6d
Merge pull request #4 from kanidm/msrv-166
yaleman Sep 15, 2023
d2e887a
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 15, 2023
2563ad7
Merge pull request #5 from kanidm/dependabot/github_actions/actions/c…
yaleman Sep 17, 2023
cc67465
Bump actions-rust-lang/setup-rust-toolchain from 1.5.0 to 1.6.0
dependabot[bot] Dec 4, 2023
c81eed0
Merge pull request #6 from kanidm/dependabot/github_actions/actions-r…
yaleman Dec 4, 2023
7913b70
Bump actions-rust-lang/setup-rust-toolchain from 1.6.0 to 1.8.0
dependabot[bot] Jan 15, 2024
5082ad3
Merge pull request #7 from kanidm/dependabot/github_actions/actions-r…
yaleman Jan 15, 2024
c461596
Bump actions-rust-lang/setup-rust-toolchain from 1.8.0 to 1.9.0
dependabot[bot] Jun 10, 2024
f900308
Merge pull request #8 from kanidm/dependabot/github_actions/actions-r…
yaleman Jun 10, 2024
0282643
Bump actions-rust-lang/setup-rust-toolchain from 1.9.0 to 1.10.0
dependabot[bot] Sep 23, 2024
7865d1a
Merge pull request #9 from kanidm/dependabot/github_actions/actions-r…
yaleman Sep 23, 2024
8e6a5c3
Bump actions-rust-lang/setup-rust-toolchain from 1.10.0 to 1.10.1
dependabot[bot] Oct 7, 2024
b126533
Merge pull request #10 from kanidm/dependabot/github_actions/actions-…
yaleman Oct 7, 2024
0dfe5bf
Bump actions-rust-lang/setup-rust-toolchain from 1.10.1 to 1.11.0
dependabot[bot] Mar 3, 2025
f979228
Merge pull request #11 from kanidm/dependabot/github_actions/actions-…
yaleman Mar 3, 2025
a09a042
Bump actions-rust-lang/setup-rust-toolchain from 1.11.0 to 1.12.0
dependabot[bot] Apr 28, 2025
a6a60a0
Merge pull request #12 from kanidm/dependabot/github_actions/actions-…
yaleman Apr 28, 2025
cb4238e
fix: lints
yaleman Apr 28, 2025
95b8c07
maint: updating MSRV
yaleman Apr 28, 2025
721f624
Merge pull request #13 from kanidm/raise-msrv
Firstyear Apr 28, 2025
b42eada
updating the badge to reflect the release cadence
yaleman Jun 13, 2025
947dba2
maint: clippy fixes for lifetimes and formatting
yaleman Jun 13, 2025
0bb79ea
maint: updating license string to match SPDX
yaleman Jun 13, 2025
186ee2f
maint: adding some coverage
yaleman Jun 13, 2025
d20e65a
maint: maintainer details
yaleman Jun 13, 2025
059b96b
fix: clippy lint about const refcell
yaleman Jun 14, 2025
0cd50c1
maint: yaml is a stupid format
yaleman Jun 14, 2025
4e1bef4
maint: update version
yaleman Jun 14, 2025
431de98
Merge pull request #14 from kanidm/maintainer-badge
Firstyear Jun 14, 2025
4afc6ca
Bump actions-rust-lang/setup-rust-toolchain from 1.12.0 to 1.13.0
dependabot[bot] Jun 23, 2025
26d5a3d
Merge pull request #15 from kanidm/dependabot/github_actions/actions-…
yaleman Jun 23, 2025
ed8ef37
Bump actions-rust-lang/setup-rust-toolchain from 1.13.0 to 1.14.0
dependabot[bot] Aug 25, 2025
088a513
Bump actions/checkout from 4 to 5
dependabot[bot] Aug 25, 2025
1a0887b
Merge pull request #17 from kanidm/dependabot/github_actions/actions/…
yaleman Aug 25, 2025
b280228
Merge pull request #16 from kanidm/dependabot/github_actions/actions-…
yaleman Aug 25, 2025
5c5bc81
Bump actions-rust-lang/setup-rust-toolchain from 1.14.0 to 1.14.1
dependabot[bot] Sep 8, 2025
791dc02
Merge pull request #18 from kanidm/dependabot/github_actions/actions-…
yaleman Sep 8, 2025
ecd569c
Bump actions-rust-lang/setup-rust-toolchain from 1.14.1 to 1.15.0
dependabot[bot] Sep 15, 2025
0f1cfb9
Merge pull request #19 from kanidm/dependabot/github_actions/actions-…
yaleman Sep 15, 2025
6965715
Bump actions-rust-lang/setup-rust-toolchain from 1.15.0 to 1.15.1
dependabot[bot] Sep 29, 2025
489e4b0
Merge pull request #20 from kanidm/dependabot/github_actions/actions-…
yaleman Sep 29, 2025
cd2004e
Bump actions-rust-lang/setup-rust-toolchain from 1.15.1 to 1.15.2
dependabot[bot] Oct 6, 2025
46da8bd
Merge pull request #21 from kanidm/dependabot/github_actions/actions-…
yaleman Oct 6, 2025
7d9a10a
Bump actions/checkout from 5 to 6
dependabot[bot] Nov 24, 2025
efc8fc3
Merge pull request #22 from kanidm/dependabot/github_actions/actions/…
yaleman Nov 24, 2025
6f590b8
Bump actions-rust-lang/setup-rust-toolchain from 1.15.2 to 1.15.3
dependabot[bot] Mar 2, 2026
aaa3b10
Merge pull request #24 from kanidm/dependabot/github_actions/actions-…
yaleman Mar 2, 2026
2ce7fe5
fn to change output type of stream deserializer
dr-bonez Dec 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
name: CI

"on":
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]

jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
version:
- { name: msrv, version: '1.81' }
- { name: stable, version: stable }
- { name: nightly, version: nightly }

name: ${{ matrix.version.name }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.15.3
with:
toolchain: ${{ matrix.version.version }}

- name: cargo check
run: cargo check --workspace --bins --examples --tests

- name: cargo test
run: |
cargo test --workspace --all-features --no-fail-fast -- --nocapture
cargo build --features=unsealed_read_write
cargo build --no-default-features --features=unsealed_read_write

build_and_test_no_std:
name: stable (no_std)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.15.3

- name: Add no_std target
run: rustup target add thumbv7em-none-eabihf

- name: cargo test
run: |
cargo build --target thumbv7em-none-eabihf --no-default-features --features=alloc
cargo test --no-default-features --lib --tests
cargo build --no-default-features --features=alloc
52 changes: 52 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Lint

"on":
pull_request:
types: [opened, synchronize, reopened]

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.15.3
with:
components: rustfmt

- name: Check with Rustfmt
run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.15.3
with:
components: clippy

- name: Check with Clippy
uses: giraffate/clippy-action@v1
with:
reporter: github-pr-check
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: --workspace --all-features --tests --examples --bins -- -Dclippy::todo -Aunknown_lints

lint-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.15.3
with:
components: rust-docs

- name: Check for broken intra-doc links
env:
RUSTDOCFLAGS: -Dwarnings
run: cargo doc --no-deps --all-features --workspace
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

## Unreleased

- Minimum supported Rust version (MSRV) is now 1.81 due to `half` dependency.

## 0.11.0

- TODO
39 changes: 20 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
[package]
name = "serde_cbor"
version = "0.11.2"
name = "serde_cbor_2"
version = "0.13.0"
authors = [
"Pyfisch <pyfisch@posteo.org>",
"Steven Fackler <sfackler@gmail.com>"]
repository = "https://github.com/pyfisch/cbor"
readme = "README.md"
license = "MIT/Apache-2.0"
description = "CBOR support for serde."
"William Brown <william@blackhats.net.au>",
"James Hodgkinson <james@terminaloutcomes.com>",
]
repository = "https://github.com/kanidm/cbor"
license = "MIT OR Apache-2.0"
description = "CBOR support for Serde."
keywords = ["serde", "cbor", "serialization", "no_std"]
categories = ["encoding"]
edition = "2018"
edition = "2021"
rust-version = "1.81"

[badges]
travis-ci = { repository = "pyfisch/cbor" }
maintenance = { status = "as-is" }

[dependencies]
half = "1.2.0"
serde = { version = "1.0.14", default-features = false }

[dev-dependencies]
serde_derive = { version = "1.0.14", default-features = false }
[badges]
maintenance = { status = "passively-maintained" }

[features]
default = ["std"]
# Uses `alloc` library and adds support for vector functions with
# `no_std`.
alloc = ["serde/alloc"]
std = ["serde/std" ]
std = ["serde/std"]
unsealed_read_write = []
tags = []

[dependencies]
half = { version = "2", default-features = false }
serde = { version = "1", default-features = false }

[dev-dependencies]
serde = { version = "1", default-features = false, features = ["derive"] }
61 changes: 22 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,27 @@
# Serde CBOR
[![Build Status](https://travis-ci.org/pyfisch/cbor.svg?branch=master)](https://travis-ci.org/pyfisch/cbor)
[![Crates.io](https://img.shields.io/crates/v/serde_cbor.svg)](https://crates.io/crates/serde_cbor)
[![Documentation](https://docs.rs/serde_cbor/badge.svg)](https://docs.rs/serde_cbor)

## PROJECT IS ARCHIVED
[![CI](https://github.com/kanidm/cbor/actions/workflows/ci.yml/badge.svg)](https://github.com/kanidm/cbor/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/serde_cbor_2.svg?label=latest)](https://crates.io/crates/serde_cbor_2)
[![Documentation](https://docs.rs/serde_cbor_2/badge.svg)](https://docs.rs/serde_cbor_2)

After almost 6 years it is time to retire this crate.
This implementation of CBOR for serde is used in hundreds of projects with widely differing needs.
Besides the standard features it contains code for no-std environments, a packed encoding and CBOR tags.
However while these features are useful to many people they sometimes interact poorly with each others and with optional features of serde itself.
Because I don't use the crate myself and because of the potential for new errors I have been reluctant to accept any changes or additional features for the crate.
Since this situation is unlikely to change anytime soon and no one else stepped up to maintain this crate I am archiving the repository today.
If the crate works for you there is no need to switch to another implementation.
However if you encounter problems or for new projects I recommend you take a look at these crates:

* [ciborium](https://crates.io/crates/ciborium)
* [minicbor](https://crates.io/crates/minicbor)

~~ Pyfisch, August 2021



This crate implements the Concise Binary Object Representation from [RFC 7049].
It builds on [Serde], the generic serialization framework for Rust.
CBOR provides a binary encoding for a superset
of the JSON data model that is small and very fast to parse.

[RFC 7049]: https://tools.ietf.org/html/rfc7049
[Serde]: https://github.com/serde-rs/serde
This crate implements the Concise Binary Object Representation from [RFC 7049][rfc7049].
It builds on [Serde][serde], the generic serialization framework for Rust.
CBOR provides a binary encoding for a superset of the JSON data model that is small and very fast to parse.

## Usage

Serde CBOR supports Rust 1.40 and up. Add this to your `Cargo.toml`:
Serde CBOR supports Rust 1.81 and up. Add this to your `Cargo.toml`:

```toml
[dependencies]
serde_cbor = "0.11.2"
serde_cbor_2 = "0.11.2"
```

Storing and loading Rust types is easy and requires only
minimal modifications to the program code.
Storing and loading Rust types is easy and requires only minimal modifications to the program code.

```rust
use serde_derive::{Deserialize, Serialize};
use std::error::Error;
use std::fs::File;
use std::{error::Error, fs::File};
use serde::{Deserialize, Serialize};

// Types annotated with `Serialize` can be stored as CBOR.
// To be able to load them again add `Deserialize`.
Expand All @@ -65,15 +43,15 @@ fn main() -> Result<(), Box<dyn Error>> {
// Write Ferris to the given file.
// Instead of a file you can use any type that implements `io::Write`
// like a HTTP body, database connection etc.
serde_cbor::to_writer(ferris_file, &ferris)?;
serde_cbor_2::to_writer(ferris_file, &ferris)?;

let tux_file = File::open("examples/tux.cbor")?;
// Load Tux from a file.
// Serde CBOR performs roundtrip serialization meaning that
// the data will not change in any way.
let tux: Mascot = serde_cbor::from_reader(tux_file)?;
let tux: Mascot = serde_cbor_2::from_reader(tux_file)?;

println!("{:?}", tux);
println!("{tux:?}");
// prints: Mascot { name: "Tux", species: "penguin", year_of_birth: 1996 }

Ok(())
Expand All @@ -84,14 +62,19 @@ There are a lot of options available to customize the format.
To operate on untyped CBOR values have a look at the `Value` type.

## License

Licensed under either of

* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.

[rfc7049]: https://tools.ietf.org/html/rfc7049
[serde]: https://github.com/serde-rs/serde
11 changes: 5 additions & 6 deletions examples/readme.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// NOTE: This file should be kept in sync with README.md

use serde_derive::{Deserialize, Serialize};
use std::error::Error;
use std::fs::File;
use serde::{Deserialize, Serialize};
use std::{error::Error, fs::File};

// Types annotated with `Serialize` can be stored as CBOR.
// To be able to load them again add `Deserialize`.
Expand All @@ -24,15 +23,15 @@ fn main() -> Result<(), Box<dyn Error>> {
// Write Ferris to the given file.
// Instead of a file you can use any type that implements `io::Write`
// like a HTTP body, database connection etc.
serde_cbor::to_writer(ferris_file, &ferris)?;
serde_cbor_2::to_writer(ferris_file, &ferris)?;

let tux_file = File::open("examples/tux.cbor")?;
// Load Tux from a file.
// Serde CBOR performs roundtrip serialization meaning that
// the data will not change in any way.
let tux: Mascot = serde_cbor::from_reader(tux_file)?;
let tux: Mascot = serde_cbor_2::from_reader(tux_file)?;

println!("{:?}", tux);
println!("{tux:?}");
// prints: Mascot { name: "Tux", species: "penguin", year_of_birth: 1996 }

Ok(())
Expand Down
25 changes: 11 additions & 14 deletions examples/tags.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_cbor::tags::Tagged;
use serde_cbor::Value;
use serde_derive::{Deserialize, Serialize};
use serde::{de::Deserializer, ser::Serializer, Deserialize, Serialize};
use serde_cbor_2::{tags::Tagged, Value};
use std::error::Error;

/// https://tools.ietf.org/html/rfc7049#section-2.4.1
Expand Down Expand Up @@ -60,17 +57,17 @@ fn main() -> Result<(), Box<dyn Error>> {
};

// serialize the struct to bytes
let bytes1 = serde_cbor::to_vec(&bookmark)?;
// deserialize to a serde_cbor::Value
let value1: Value = serde_cbor::from_slice(&bytes1)?;
println!("{:?}", value1);
let bytes1 = serde_cbor_2::to_vec(&bookmark)?;
// deserialize to a serde_cbor_2::Value
let value1: Value = serde_cbor_2::from_slice(&bytes1)?;
println!("{value1:?}");
// serialize the value to bytes
let bytes2 = serde_cbor::to_vec(&value1)?;
// deserialize to a serde_cbor::Value
let value2: Value = serde_cbor::from_slice(&bytes2)?;
println!("{:?}", value2);
let bytes2 = serde_cbor_2::to_vec(&value1)?;
// deserialize to a serde_cbor_2::Value
let value2: Value = serde_cbor_2::from_slice(&bytes2)?;
println!("{value2:?}");
// deserialize to a Bookmark
let result: Bookmark = serde_cbor::from_slice(&bytes2)?;
let result: Bookmark = serde_cbor_2::from_slice(&bytes2)?;

// check that the roundtrip was successful
assert_eq!(value1, value2);
Expand Down
Loading