pub struct ConstantCurve { /* private fields */ }
Expand description
A representation of a flat demand curve supporting interval, half-line, and full-line trading domains
A constant curve represents a fixed price for trades within a specified rate interval. This can be used to express indifference to (potentially unbounded) trade rates at a specific price.
The sign convention follows flow trading standards:
- min_rate ≤ 0 (non-positive): maximum selling rate
- max_rate ≥ 0 (non-negative): maximum buying rate
Implementations§
Source§impl ConstantCurve
impl ConstantCurve
Sourcepub unsafe fn new_unchecked(min_rate: f64, max_rate: f64, price: f64) -> Self
pub unsafe fn new_unchecked(min_rate: f64, max_rate: f64, price: f64) -> Self
Creates a new constant constraint without validation
§Safety
This function is unsafe because it bypasses validation of rates and price. It should only be used when the caller can guarantee the values are valid.
Trait Implementations§
Source§impl Clone for ConstantCurve
impl Clone for ConstantCurve
Source§fn clone(&self) -> ConstantCurve
fn clone(&self) -> ConstantCurve
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ConstantCurve
impl Debug for ConstantCurve
Source§impl From<ConstantCurve> for DemandCurve
impl From<ConstantCurve> for DemandCurve
Source§fn from(value: ConstantCurve) -> Self
fn from(value: ConstantCurve) -> Self
Converts to this type from the input type.
Source§impl Into<ConstantCurveDto> for ConstantCurve
impl Into<ConstantCurveDto> for ConstantCurve
Source§fn into(self) -> ConstantCurveDto
fn into(self) -> ConstantCurveDto
Converts this type into the (usually inferred) input type.
Source§impl TryFrom<ConstantCurveDto> for ConstantCurve
impl TryFrom<ConstantCurveDto> for ConstantCurve
Source§type Error = ConstantCurveError
type Error = ConstantCurveError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for ConstantCurve
impl RefUnwindSafe for ConstantCurve
impl Send for ConstantCurve
impl Sync for ConstantCurve
impl Unpin for ConstantCurve
impl UnwindSafe for ConstantCurve
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