Skip to content

Commit 1b2f901

Browse files
dfawleyarjan-baleaswars
authored
Merge changes from next to master branch (#2315)
Co-authored-by: Arjan Singh Bal <46515553+arjan-bal@users.noreply.github.com> Co-authored-by: Easwar Swaminathan <easwars@google.com>
1 parent 2737de3 commit 1b2f901

File tree

21 files changed

+2414
-371
lines changed

21 files changed

+2414
-371
lines changed

grpc/Cargo.toml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,29 @@ name = "grpc"
33
version = "0.9.0-alpha.1"
44
edition = "2021"
55
authors = ["gRPC Authors"]
6-
license = "Apache-2.0"
6+
license = "MIT"
77

88
[dependencies]
99
url = "2.5.0"
10-
tokio = { version = "1.37.0", features = ["sync"] }
10+
tokio = { version = "1.37.0", features = ["sync", "rt", "net", "time", "macros"] }
1111
tonic = { version = "0.14.0", path = "../tonic", default-features = false, features = ["codegen"] }
12+
futures-core = "0.3.31"
13+
serde_json = "1.0.140"
14+
serde = "1.0.219"
15+
hickory-resolver = { version = "0.25.1", optional = true }
16+
rand = "0.8.5"
17+
parking_lot = "0.12.4"
18+
bytes = "1.10.1"
19+
20+
[dev-dependencies]
21+
hickory-server = "0.25.2"
22+
23+
[features]
24+
default = ["dns"]
25+
dns = ["dep:hickory-resolver"]
26+
27+
[package.metadata.cargo_check_external_types]
28+
allowed_external_types = [
29+
"tonic::*",
30+
"futures_core::stream::Stream",
31+
]

grpc/LICENSE

Lines changed: 0 additions & 202 deletions
This file was deleted.

grpc/NOTICE.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

grpc/src/attributes.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
*
33
* Copyright 2025 gRPC authors.
44
*
5-
* Licensed under the Apache License, Version 2.0 (the "License");
6-
* you may not use this file except in compliance with the License.
7-
* You may obtain a copy of the License at
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to
7+
* deal in the Software without restriction, including without limitation the
8+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9+
* sell copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
811
*
9-
* http://www.apache.org/licenses/LICENSE-2.0
12+
* The above copyright notice and this permission notice shall be included in
13+
* all copies or substantial portions of the Software.
1014
*
11-
* Unless required by applicable law or agreed to in writing, software
12-
* distributed under the License is distributed on an "AS IS" BASIS,
13-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
* See the License for the specific language governing permissions and
15-
* limitations under the License.
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21+
* IN THE SOFTWARE.
1622
*
1723
*/
1824

grpc/src/byte_str.rs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
*
3+
* Copyright 2025 gRPC authors.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to
7+
* deal in the Software without restriction, including without limitation the
8+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9+
* sell copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in
13+
* all copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21+
* IN THE SOFTWARE.
22+
*
23+
*/
24+
25+
use core::str;
26+
use std::ops::Deref;
27+
28+
use bytes::Bytes;
29+
30+
/// A cheaply cloneable and sliceable chunk of contiguous memory.
31+
#[derive(Debug, Default, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
32+
pub struct ByteStr {
33+
// Invariant: bytes contains valid UTF-8
34+
bytes: Bytes,
35+
}
36+
37+
impl Deref for ByteStr {
38+
type Target = str;
39+
40+
#[inline]
41+
fn deref(&self) -> &str {
42+
let b: &[u8] = self.bytes.as_ref();
43+
// The invariant of `bytes` is that it contains valid UTF-8 allows us
44+
// to unwrap.
45+
str::from_utf8(b).unwrap()
46+
}
47+
}
48+
49+
impl From<String> for ByteStr {
50+
#[inline]
51+
fn from(src: String) -> ByteStr {
52+
ByteStr {
53+
// Invariant: src is a String so contains valid UTF-8.
54+
bytes: Bytes::from(src),
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)