pub struct PwlCurveDto(pub Vec<Point>);Expand description
DTO to ensure that we always validate when we deserialize from an untrusted source
Tuple Fields§
§0: Vec<Point>Trait Implementations§
Source§impl Debug for PwlCurveDto
impl Debug for PwlCurveDto
Source§impl Into<PwlCurveDto> for PwlCurve
impl Into<PwlCurveDto> for PwlCurve
Source§fn into(self) -> PwlCurveDto
fn into(self) -> PwlCurveDto
Converts this type into the (usually inferred) input type.
Source§impl TryFrom<PwlCurveDto> for DemandCurve
impl TryFrom<PwlCurveDto> for DemandCurve
Source§type Error = PwlCurveError
type Error = PwlCurveError
The type returned in the event of a conversion error.
Source§impl TryFrom<PwlCurveDto> for PwlCurve
impl TryFrom<PwlCurveDto> for PwlCurve
Source§fn try_from(value: PwlCurveDto) -> Result<Self, Self::Error>
fn try_from(value: PwlCurveDto) -> Result<Self, Self::Error>
Attempts to create a PwlCurve from a DTO, validating all constraints
§Validation
This function validates that:
- The vector is not empty
- No coordinate values are NaN
- Points are ordered by ascending rate and descending price (monotonicity)
- The curve domain includes rate=0 (allows zero trade)
§Errors
Returns PwlCurveError if any validation fails.
Source§type Error = PwlCurveError
type Error = PwlCurveError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for PwlCurveDto
impl RefUnwindSafe for PwlCurveDto
impl Send for PwlCurveDto
impl Sync for PwlCurveDto
impl Unpin for PwlCurveDto
impl UnwindSafe for PwlCurveDto
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