diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aefdfaa..8f1c534 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: build: strategy: matrix: - rust-version: ["1.70.0", "1.74.0", "1.78.0", "1.83.0", "1.87.0"] + rust-version: ["1.78.0", "1.83.0", "1.87.0", "1.99.0"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -25,7 +25,7 @@ jobs: build-no_std: strategy: matrix: - rust-version: ["1.70.0", "1.74.0", "1.78.0", "1.83.0", "1.87.0"] + rust-version: ["1.78.0", "1.83.0", "1.87.0", "1.99.0"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -38,7 +38,7 @@ jobs: test: strategy: matrix: - rust-version: ["1.70.0", "1.74.0", "1.78.0", "1.83.0", "1.87.0"] + rust-version: ["1.78.0", "1.83.0", "1.87.0", "1.99.0"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -50,7 +50,7 @@ jobs: test-no_std: strategy: matrix: - rust-version: ["1.70.0", "1.74.0", "1.78.0", "1.83.0", "1.87.0"] + rust-version: ["1.78.0", "1.83.0", "1.87.0", "1.99.0"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -62,7 +62,7 @@ jobs: clippy: strategy: matrix: - rust-version: ["1.70.0", "1.74.0", "1.78.0", "1.83.0", "1.87.0"] + rust-version: ["1.78.0", "1.83.0", "1.87.0", "1.99.0"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/Cargo.lock b/Cargo.lock index 0b16df7..ad21228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "anybuf" diff --git a/Cargo.toml b/Cargo.toml index 2ed64d5..14da738 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "anybuf" version = "1.0.0" edition = "2021" +rust-version = "1.78" license = "Apache-2.0" description = "A minimal, zero dependency proto3 encoder to encode/decode anything. No schemas needed." keywords = ["protobuf3", "protobuf", "proto3", "proto", "encoding"] diff --git a/src/bufany.rs b/src/bufany.rs index 3c14411..9459027 100644 --- a/src/bufany.rs +++ b/src/bufany.rs @@ -846,7 +846,7 @@ impl<'a> Bufany<'a> { /// Gets the value of the given field number. This returns None if /// the field number does not exist - pub fn value(&self, field_number: u32) -> Option { + pub fn value(&self, field_number: u32) -> Option> { self.value_ref(field_number).cloned() } @@ -866,6 +866,10 @@ impl<'a> Bufany<'a> { } /// A deserialized value +/// +/// The lifetime `'a` is the lifetime of the serialized input: variable length values +/// (i.e. bytes and strings) borrow their bytes from it instead of copying them (zero-copy). +/// When `Value<'a>` is cloned, the clone still borrows the original data. #[derive(Debug, PartialEq, Clone)] pub enum Value<'a> { /// Unknown varint (wire type = 0).