fn maybe_update_budget(
    budget_map: &mut HashMap<ImmutableString, usize>,
    moniker: &str,
    bytes: usize,
    byte_limit: usize,
) -> bool {
    if let Some(remaining_budget) = budget_map.get_mut(moniker) {
        if *remaining_budget + bytes > byte_limit {
            false
        } else {
            *remaining_budget += bytes;
            true
        }
    } else if bytes > byte_limit {
        budget_map.insert(moniker.to_string().into_boxed_str(), 0);
        false
    } else {
        budget_map.insert(moniker.to_string().into_boxed_str(), bytes);
        true
    }
}
// Checks if a given schema is within a components budget, and if it is, updates the budget,
// then returns true. Otherwise, if the schema is not within budget, returns false.
Checks if a given schema is within a components budget, and if it is, updates the budget,
then returns true. Otherwise, if the schema is not within budget, returns false.
Checks if a given schema is within a components budget and if it is updates the budget then returns true . Otherwise if the schema is not within budget returns false .
fn maybe_update_budget(
    budget_map: &mut HashMap<ImmutableString, usize>,
    moniker: &str,
    bytes: usize,
    byte_limit: usize,
) -> bool {
    if let Some(remaining_budget) = budget_map.get_mut(moniker) {
        if *remaining_budget + bytes > byte_limit {
            false
        } else {
            *remaining_budget += bytes;
            true
        }
    } else if bytes > byte_limit {
        budget_map.insert(moniker.to_string().into_boxed_str(), 0);
        false
    } else {
        budget_map.insert(moniker.to_string().into_boxed_str(), bytes);
        true
    }
}
fn maybe_update_budget ( budget_map : & mut HashMap < ImmutableString , usize > , moniker : & str , bytes : usize , byte_limit : usize , ) -> bool { if let Some ( remaining_budget ) = budget_map . get_mut ( moniker ) { if * remaining_budget + bytes > byte_limit { false } else { * remaining_budget += bytes ; true } } else if bytes > byte_limit { budget_map . insert ( moniker . to_string ( ) . into_boxed_str ( ) , 0 ) ; false } else { budget_map . insert ( moniker . to_string ( ) . into_boxed_str ( ) , bytes ) ; true } }
Checks if a given schema is within a components budget, and if it is, updates the budget,
then returns true.
Checks if a given schema is within a components budget and if it is updates the budget then returns true .
budget_map
&mut HashMap<ImmutableString, usize>
moniker
&str
bytes
usize
byte_limit
usize
budget_map
&mut HashMap<ImmutableString, usize>
moniker
&str
bytes
usize
byte_limit
usize