impl camel_endpoint :: UriConfig for TimerConfig { fn scheme () -> & 'static str { "timer" } fn from_uri (uri : & str) -> Result < Self , camel_endpoint :: CamelError > { let parts = camel_endpoint :: parse_uri (uri) ? ; Self :: from_components (parts) } fn from_components (parts : camel_endpoint :: UriComponents) -> Result < Self , camel_endpoint :: CamelError > { let config = Self :: parse_uri_components (parts) ? ; config . validate () } } impl TimerConfig { # [doc = r" Parse URI components into this config."] pub fn parse_uri_components (parts : camel_endpoint :: UriComponents) -> Result < Self , camel_endpoint :: CamelError > { if parts . scheme != "timer" { return Err (camel_endpoint :: CamelError :: InvalidUri (format ! ("expected scheme '{}' but got '{}'" , "timer" , parts . scheme))) ; } let params = & parts . params ; let name = parts . path . clone () ; let optional = params . get ("optName") . cloned () ; let multi = params . get ("multi") . ok_or_else (|| camel_endpoint :: CamelError :: InvalidUri (format ! ("missing required parameter: {}" , "multi"))) ? . parse :: < Vec < String > > () . map_err (| e | camel_endpoint :: CamelError :: InvalidUri (format ! ("invalid value for parameter '{}': {}" , "multi" , e))) ? ; let flag = match params . get ("flag") { Some (v) => camel_endpoint :: uri :: parse_bool_param (v) . map_err (| e | camel_endpoint :: CamelError :: InvalidUri (format ! ("invalid value for {}: {}" , "flag" , e))) ? , None => true , } ; Ok (Self { name , optional , multi , flag }) } # [doc = r" Generated URI option definitions, one per `#[uri_param]` field."] # [doc = r" The path field is excluded."] pub fn uri_options () -> :: std :: vec :: Vec < camel_endpoint :: UriOption > { vec ! [camel_endpoint :: UriOption :: new ("optName" , "" , camel_endpoint :: OptionKind :: String) , camel_endpoint :: UriOption :: new ("multi" , "" , camel_endpoint :: OptionKind :: List (:: std :: boxed :: Box :: new (camel_endpoint :: OptionKind :: String))) . required () , camel_endpoint :: UriOption :: new ("flag" , "" , camel_endpoint :: OptionKind :: Bool) . with_default ("true")] } }