File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ name = "init4-bin-base"
44description = " Internal utilities for binaries produced by the init4 team"
55keywords = [" init4" , " bin" , " base" ]
66
7- version = " 0.1.2 "
7+ version = " 0.1.3 "
88edition = " 2021"
99rust-version = " 1.81"
1010authors = [" init4" , " James Prestwich" ]
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3434 tracing:: info!( "serving hello world" ) ;
3535 Ok :: < _ , ( ) > ( "Hello, world!" )
3636 } )
37+ . route ( "addNumbers" , |( a, b) : ( u32 , u32 ) | async move {
38+ tracing:: info!( "serving addNumbers" ) ;
39+ Ok :: < _ , ( ) > ( a + b)
40+ } )
3741 . into_axum ( "/rpc" ) ;
3842
3943 let listener = tokio:: net:: TcpListener :: bind ( "localhost:8080" )
Original file line number Diff line number Diff line change @@ -39,6 +39,17 @@ impl<Inner> FromEnvErr<Inner> {
3939 }
4040 }
4141
42+ /// Map the error to another type. This is useful for converting the error
43+ /// type to a different type, while keeping the other error information
44+ /// intact.
45+ pub fn map < New > ( self , f : impl FnOnce ( Inner ) -> New ) -> FromEnvErr < New > {
46+ match self {
47+ Self :: EnvError ( s, e) => FromEnvErr :: EnvError ( s, e) ,
48+ Self :: Empty ( s) => FromEnvErr :: Empty ( s) ,
49+ Self :: ParseError ( e) => FromEnvErr :: ParseError ( f ( e) ) ,
50+ }
51+ }
52+
4253 /// Missing env var.
4354 pub fn env_err ( var : & str , e : VarError ) -> Self {
4455 Self :: EnvError ( var. to_string ( ) , e)
Original file line number Diff line number Diff line change @@ -134,8 +134,8 @@ impl OtelConfig {
134134 ///
135135 /// The env vars it checks are:
136136 /// - `OTEL_EXPORTER_OTLP_ENDPOINT` - optional. The endpoint to send traces
137- /// to. If missing or unparsable, this function will return [`None`], and
138- /// OTLP exporting will be disabled.
137+ /// to. If missing or unparsable, this function will return [`None`], and
138+ /// OTLP exporting will be disabled.
139139 /// - `OTEL_LEVEL` - optional. Specifies the minimum [`tracing::Level`] to
140140 /// export. Defaults to [`tracing::Level::DEBUG`].
141141 /// - `OTEL_TIMEOUT` - optional. Specifies the timeout for the exporter in
You can’t perform that action at this time.
0 commit comments