pub fn instance_apply_mut<T: 'static, R, F: FnOnce(&mut Configuration<T>) -> R>(
    id: &Identifier,
    f: F,
) -> Result<R> {
    match lock(&SINGLETONS).get_mut(id) {
        Some(instance) => match instance.downcast_mut() {
            Some(config) => Ok(f(config)),
            None => {
                return Err(Error::InvalidArgument(format!(
                    "wrong type specified for configuration {:?}",
                    id
                )));
            }
        },
        None => {
            return Err(Error::InvalidArgument(format!(
                "unrecognized configuration identifier: {:?}",
                id
            )));
        }
    }
}
/// instance_apply_mut is a very generic function which applies the given
/// mutation function once to the configuration singleton matching the given
/// identifier. It is an error if the identifier is unrecognized, or if the
/// given callback operates on a Configuration of the wrong type.
instance_apply_mut is a very generic function which applies the given
mutation function once to the configuration singleton matching the given
identifier. It is an error if the identifier is unrecognized, or if the
given callback operates on a Configuration of the wrong type.
instance_apply_mut is a very generic function which applies the given mutation function once to the configuration singleton matching the given identifier . It is an error if the identifier is unrecognized or if the given callback operates on a Configuration of the wrong type .
pub fn instance_apply_mut<T: 'static, R, F: FnOnce(&mut Configuration<T>) -> R>(
    id: &Identifier,
    f: F,
) -> Result<R> {
    match lock(&SINGLETONS).get_mut(id) {
        Some(instance) => match instance.downcast_mut() {
            Some(config) => Ok(f(config)),
            None => {
                return Err(Error::InvalidArgument(format!(
                    "wrong type specified for configuration {:?}",
                    id
                )));
            }
        },
        None => {
            return Err(Error::InvalidArgument(format!(
                "unrecognized configuration identifier: {:?}",
                id
            )));
        }
    }
}
pub fn instance_apply_mut < T : ' static , R , F : FnOnce ( & mut Configuration < T > ) -> R > ( id : & Identifier , f : F , ) -> Result < R > { match lock ( & SINGLETONS ) . get_mut ( id ) { Some ( instance ) => match instance . downcast_mut ( ) { Some ( config ) => Ok ( f ( config ) ) , None => { return Err ( Error :: InvalidArgument ( format ! ( " " id ) ) ) ; } } , None => { return Err ( Error :: InvalidArgument ( format ! ( " " id ) ) ) ; } } }
instance_apply_mut is a very generic function which applies the given
mutation function once to the configuration singleton matching the given
identifier.
instance_apply_mut is a very generic function which applies the given mutation function once to the configuration singleton matching the given identifier .
id
&Identifier
f
F
id
&Identifier
f
F