pub struct CostPolicy {
pub weight: f64,
pub region_costs: HashMap<RegionId, f64>,
}Expand description
Cost-based routing policy
Balances cost vs performance based on user tolerance.
Fields§
§weight: f64Weight for this policy
region_costs: HashMap<RegionId, f64>Cost per region (0.0 = cheapest, 1.0 = most expensive)
Implementations§
Source§impl CostPolicy
impl CostPolicy
pub fn with_region_cost(self, region: RegionId, cost: f64) -> Self
Trait Implementations§
Source§impl Default for CostPolicy
impl Default for CostPolicy
Source§impl RoutingPolicyTrait for CostPolicy
impl RoutingPolicyTrait for CostPolicy
Source§fn score(&self, candidate: &RouteCandidate, request: &InferenceRequest) -> f64
fn score(&self, candidate: &RouteCandidate, request: &InferenceRequest) -> f64
Score a candidate node (higher = better)
Source§fn is_eligible(
&self,
_candidate: &RouteCandidate,
_request: &InferenceRequest,
) -> bool
fn is_eligible( &self, _candidate: &RouteCandidate, _request: &InferenceRequest, ) -> bool
Check if a candidate is eligible
Auto Trait Implementations§
impl Freeze for CostPolicy
impl RefUnwindSafe for CostPolicy
impl Send for CostPolicy
impl Sync for CostPolicy
impl Unpin for CostPolicy
impl UnwindSafe for CostPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more