Skip to content

Commit 17bb6be

Browse files
committed
tink-proto: move to core+alloc
The "json" feature requires the base64 and serde dependencies to have their "alloc" feature enabled.
1 parent abe4b49 commit 17bb6be

File tree

3 files changed

+114
-34
lines changed

3 files changed

+114
-34
lines changed

Cargo.lock

+102-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tink-proto"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
authors = ["David Drysdale <[email protected]>"]
55
edition = "2018"
66
license = "Apache-2.0"
@@ -14,9 +14,9 @@ default = []
1414
json = ["base64", "serde"]
1515

1616
[dependencies]
17-
base64 = { version = "^0.13", optional = true }
18-
prost = "^0.8"
19-
serde = { version = "^1.0.126", features = ["derive"], optional = true }
17+
base64 = { version = "^0.13", default-features = false, features = ["alloc"], optional = true }
18+
prost = { version = "^0.8", default-features = false }
19+
serde = { version = "^1.0.126", default-features = false, features = ["alloc", "derive"], optional = true }
2020

2121
[build-dependencies]
2222
prost-build = "^0.8"

proto/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616

1717
//! Protocol buffer message definitions for Tink.
1818
19+
#![no_std]
1920
#![deny(broken_intra_doc_links)]
2021

22+
#[cfg(feature = "json")]
23+
extern crate alloc;
24+
2125
#[cfg(not(feature = "json"))]
2226
include!("codegen/google.crypto.tink.rs");
2327
#[cfg(feature = "json")]
@@ -30,6 +34,7 @@ pub mod json {
3034
//! the `i32` values used by prost.
3135
pub mod key_status_type {
3236
//! Manual JSON serialization for [`KeyStatusType`](crate::KeyStatusType) enums.
37+
use alloc::string::String;
3338
use serde::Deserialize;
3439
pub fn serialize<S: serde::Serializer>(
3540
val: &i32,
@@ -56,6 +61,7 @@ pub mod json {
5661
}
5762
pub mod output_prefix_type {
5863
//! Manual JSON serialization for [`OutputPrefixType`](crate::OutputPrefixType) enums.
64+
use alloc::string::String;
5965
use serde::Deserialize;
6066
pub fn serialize<S: serde::Serializer>(
6167
val: &i32,
@@ -85,6 +91,7 @@ pub mod json {
8591
pub mod key_material_type {
8692
//! Manual JSON serialization for [`KeyMaterialType`](crate::key_data::KeyMaterialType)
8793
//! enums.
94+
use alloc::string::String;
8895
use serde::Deserialize;
8996
pub fn serialize<S: serde::Serializer>(
9097
val: &i32,
@@ -113,6 +120,7 @@ pub mod json {
113120
}
114121
pub mod b64 {
115122
//! Manual serialization implementations for base64-encoded binary data.
123+
use alloc::{string::String, vec::Vec};
116124
use serde::Deserialize;
117125
pub fn serialize<S: serde::Serializer>(
118126
val: &[u8],

0 commit comments

Comments
 (0)