pub fn generate_path<T>(parameters: &T, schema: &Schema) -> Result<String, StructPathError> where T: serde::Serialize {
    let mut serializer = Serializer{
        serialized_values: HashMap::new(),
        state: SerializerState::Start,
    };
    parameters.serialize(&mut serializer)?;
    let mut generated_path = String::new();
    for segment_schema in &schema.segments {
        match segment_schema {
            SegmentSchema::Literal(literal) => generated_path = format!("{}/{}", generated_path, literal),
            SegmentSchema::Value(segment_value_schema) => match serializer.serialized_values.get(&segment_value_schema.name) {
                Some(value) => generated_path = format!("{}/{}", generated_path, value),
                None => return Err(StructPathError::MissingField(segment_value_schema.name.clone())),
            }
        }
    }
    Ok(generated_path)
}
/// Generate a string url path given parameters and a `Schema`
Generate a string url path given parameters and a `Schema`
Generate a string url path given parameters and a ` Schema `
pub fn generate_path<T>(parameters: &T, schema: &Schema) -> Result<String, StructPathError> where T: serde::Serialize {
    let mut serializer = Serializer{
        serialized_values: HashMap::new(),
        state: SerializerState::Start,
    };
    parameters.serialize(&mut serializer)?;
    let mut generated_path = String::new();
    for segment_schema in &schema.segments {
        match segment_schema {
            SegmentSchema::Literal(literal) => generated_path = format!("{}/{}", generated_path, literal),
            SegmentSchema::Value(segment_value_schema) => match serializer.serialized_values.get(&segment_value_schema.name) {
                Some(value) => generated_path = format!("{}/{}", generated_path, value),
                None => return Err(StructPathError::MissingField(segment_value_schema.name.clone())),
            }
        }
    }
    Ok(generated_path)
}
pub fn generate_path < T > ( parameters : & T , schema : & Schema ) -> Result < String , StructPathError > where T : serde :: Serialize { let mut serializer = Serializer { serialized_values : HashMap :: new ( ) , state : SerializerState :: Start , } ; parameters . serialize ( & mut serializer ) ? ; let mut generated_path = String :: new ( ) ; for segment_schema in & schema . segments { match segment_schema { SegmentSchema :: Literal ( literal ) => generated_path = format ! ( " " generated_path literal ) , SegmentSchema :: Value ( segment_value_schema ) => match serializer . serialized_values . get ( & segment_value_schema . name ) { Some ( value ) => generated_path = format ! ( " " generated_path value ) , None => return Err ( StructPathError :: MissingField ( segment_value_schema . name . clone ( ) ) ) , } } } Ok ( generated_path ) }
Generate a string url path given parameters and a `Schema`
Generate a string url path given parameters and a ` Schema `
parameters
&T
schema
&Schema
parameters
&T
schema
&Schema