Skip to content

Rust: Examples for the interceptor documentation do not compile #7052

Closed
@DavidSouther

Description

@DavidSouther

See awslabs/aws-sdk-rust#1212


MathieuDuponchelle:

I am trying to make use of the interceptor API.

The example in the documentation @ https://docs.rs/aws-sdk-transcribestreaming/latest/aws_sdk_transcribestreaming/config/struct.Builder.html#method.interceptor does not compile.

Once I do get it to compile, I'm also only getting my read_before_deserialization() implementation called once:

  #[derive(Debug)] 
  struct MyInterceptor {                                                                                                       
  }       
                                                                                                                               
  impl Intercept for MyInterceptor {                                                                                           
      fn name(&self) -> &'static str {                                                                                         
          "transcriber-stream"                                                                                                 
      }                                                                                                                        
  
      fn read_before_deserialization(&self,                                                                                    
          _context: &BeforeDeserializationInterceptorContextRef<'_>,                                                           
          _runtime_components: &RuntimeComponents, _cfg: &mut ConfigBag,) -> Result<(), Box<dyn core::error::Error + Send + Sync>> {      
          eprintln!("Here");
       
          Ok(())
      }
  } 

// ...

              let my_interceptor = MyInterceptor {};
              let builder = aws_transcribe::config::Builder::from(aws_config)
                  .interceptor(my_interceptor);
              aws_transcribe::Client::from_conf(builder.build())

Links
https://docs.rs/aws-sdk-transcribestreaming/latest/aws_sdk_transcribestreaming/config/struct.Builder.html#method.interceptor

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions