pub struct ReflectionRequest {
pub host: String,
pub metadata: Option<Metadata>,
}
Expand description
Holds all the necessary data for a reflection request.
Fields§
§host: String
The host address.
metadata: Option<Metadata>
The requests metadata.
Implementations§
Source§impl ReflectionRequest
impl ReflectionRequest
Sourcepub fn new(host: &str) -> Self
pub fn new(host: &str) -> Self
Creates a new reflection request with a given hostname.
Examples found in repository?
examples/reflection.rs (line 13)
12async fn main() -> Result<()> {
13 let request = ReflectionRequest::new("http://localhost:50051");
14 let desc = ProtoDescriptor::from_reflection(request).await?;
15 let service = &desc.get_services()[0];
16 let method = &desc.get_methods(service)[0];
17 println!("Service: {:}", service.full_name());
18 println!("Method: {:}", method.full_name());
19 //
20 let mut req = desc.get_request(&method);
21 req.set_address("http://localhost:50051");
22
23 let mut req = desc.get_request(&method);
24 req.set_address("http://localhost:50051");
25
26 Ok(())
27}
Trait Implementations§
Source§impl Clone for ReflectionRequest
impl Clone for ReflectionRequest
Source§fn clone(&self) -> ReflectionRequest
fn clone(&self) -> ReflectionRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ReflectionRequest
impl RefUnwindSafe for ReflectionRequest
impl Send for ReflectionRequest
impl Sync for ReflectionRequest
impl Unpin for ReflectionRequest
impl UnwindSafe for ReflectionRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request