Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
maximevtush authored Feb 4, 2025
2 parents 7b415e4 + 78be69e commit 2dcf647
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ deny = [
{ crate = "term" },
]
skip = [
{ crate = "[email protected]", reason = "quickcheck depends on rand which depends on it" },
{ crate = "[email protected]+wasi-snapshot-preview1", reason = "quickcheck depends on rand which depends on it" },
{ crate = "[email protected]", reason = "aws-lc-sys depends on bindgen which depends on it" },
{ crate = "[email protected]", reason = "protox depends on miette wich depends on it" },
]
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ async-stream = { version = "0.3", optional = true }
tokio-stream = { version = "0.1", optional = true }
tokio-util = { version = "0.7.8", optional = true }
tower = { version = "0.5", optional = true }
rand = { version = "0.8", optional = true }
rand = { version = "0.9", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
tracing = { version = "0.1.16", optional = true }
Expand Down
8 changes: 4 additions & 4 deletions examples/routeguide-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ use rand::Rng;

```rust
async fn run_record_route(client: &mut RouteGuideClient<Channel>) -> Result<(), Box<dyn Error>> {
let mut rng = rand::thread_rng();
let point_count: i32 = rng.gen_range(2..100);
let mut rng = rand::rng();
let point_count: i32 = rng.random_range(2..100);

let mut points = vec![];
for _ in 0..=point_count {
Expand All @@ -715,8 +715,8 @@ async fn run_record_route(client: &mut RouteGuideClient<Channel>) -> Result<(),

```rust
fn random_point(rng: &mut ThreadRng) -> Point {
let latitude = (rng.gen_range(0..180) - 90) * 10_000_000;
let longitude = (rng.gen_range(0..360) - 180) * 10_000_000;
let latitude = (rng.random_range(0..180) - 90) * 10_000_000;
let longitude = (rng.random_range(0..360) - 180) * 10_000_000;
Point {
latitude,
longitude,
Expand Down
8 changes: 4 additions & 4 deletions examples/src/routeguide/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ async fn print_features(client: &mut RouteGuideClient<Channel>) -> Result<(), Bo
}

async fn run_record_route(client: &mut RouteGuideClient<Channel>) -> Result<(), Box<dyn Error>> {
let mut rng = rand::thread_rng();
let point_count: i32 = rng.gen_range(2..100);
let mut rng = rand::rng();
let point_count: i32 = rng.random_range(2..100);

let mut points = vec![];
for _ in 0..=point_count {
Expand Down Expand Up @@ -115,8 +115,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}

fn random_point(rng: &mut ThreadRng) -> Point {
let latitude = (rng.gen_range(0..180) - 90) * 10_000_000;
let longitude = (rng.gen_range(0..360) - 180) * 10_000_000;
let latitude = (rng.random_range(0..180) - 90) * 10_000_000;
let longitude = (rng.random_range(0..360) - 180) * 10_000_000;
Point {
latitude,
longitude,
Expand Down
4 changes: 2 additions & 2 deletions interop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ pub fn trace_init() {
pub fn client_payload(size: usize) -> pb::Payload {
pb::Payload {
r#type: default::Default::default(),
body: iter::repeat(0u8).take(size).collect(),
body: iter::repeat_n(0u8, size).collect(),
}
}

pub fn server_payload(size: usize) -> pb::Payload {
pb::Payload {
r#type: default::Default::default(),
body: iter::repeat(0u8).take(size).collect(),
body: iter::repeat_n(0u8, size).collect(),
}
}

Expand Down
6 changes: 6 additions & 0 deletions tonic/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ impl<T> Response<T> {
}
}

impl<T> From<T> for Response<T> {
fn from(inner: T) -> Self {
Response::new(inner)
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 2dcf647

Please sign in to comment.