Skip to content

Commit

Permalink
WIP: Migrate BlobProvider to ZeroMap
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Sep 22, 2021
1 parent fea0eb7 commit 7e1feeb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions provider/blob/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ serde = { version = "1.0", default-features = false, features = ["alloc"] }
postcard = { version = "0.7.0" }
erased-serde = { version = "0.3", default-features = false, features = ["alloc"] }
litemap = { version = "0.2.0", path = "../../utils/litemap/", features = ["serde"] }
zerovec = { version = "0.3", path = "../../utils/zerovec", features = ["serde"] }
writeable = { path = "../../utils/writeable" }

# For the export feature
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions provider/blob/src/blob_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

use litemap::LiteMap;
use zerovec::*;
use alloc::string::String;
use alloc::vec::Vec;

/// A versioned Serde schema for ICU4X data blobs.
#[derive(serde::Serialize, serde::Deserialize)]
Expand All @@ -14,7 +17,6 @@ pub enum BlobSchema<'data> {
/// Version 1 of the ICU4X data blob schema.
#[derive(serde::Serialize, serde::Deserialize)]
pub struct BlobSchemaV1<'data> {
// TODO(#829): Use ZeroMap instead of LiteMap.
#[serde(borrow)]
pub resources: LiteMap<&'data str, &'data [u8]>,
pub resources: ZeroMap<'data, String, Vec<u8>>,
}
1 change: 0 additions & 1 deletion provider/blob/src/static_data_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ impl StaticDataProvider {
blob.resources
.get(&*path)
.ok_or(DataError::MissingResourceKey(req.resource_path.key))
.map(|v| *v)
}
}

Expand Down

0 comments on commit 7e1feeb

Please sign in to comment.