Struct SimpleReturn
pub struct SimpleReturn { /* private fields */ }Expand description
A finite simple return value.
Implementations§
§impl SimpleReturn
impl SimpleReturn
pub fn new(value: f64) -> Result<SimpleReturn, ReturnError>
pub fn new(value: f64) -> Result<SimpleReturn, ReturnError>
Creates a simple return from a finite value.
§Errors
Returns [ReturnError::NonFiniteReturn] when value is not finite.
pub fn from_prices(
start_price: f64,
end_price: f64,
) -> Result<SimpleReturn, ReturnError>
pub fn from_prices( start_price: f64, end_price: f64, ) -> Result<SimpleReturn, ReturnError>
Computes a simple return as end_price / start_price - 1.0.
§Errors
Returns [ReturnError] when either price is not finite, the start price is not positive,
or the end price is negative.
Trait Implementations§
§impl Clone for SimpleReturn
impl Clone for SimpleReturn
§fn clone(&self) -> SimpleReturn
fn clone(&self) -> SimpleReturn
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for SimpleReturn
impl Debug for SimpleReturn
§impl Display for SimpleReturn
impl Display for SimpleReturn
§impl PartialEq for SimpleReturn
impl PartialEq for SimpleReturn
§impl PartialOrd for SimpleReturn
impl PartialOrd for SimpleReturn
impl Copy for SimpleReturn
impl StructuralPartialEq for SimpleReturn
Auto Trait Implementations§
impl Freeze for SimpleReturn
impl RefUnwindSafe for SimpleReturn
impl Send for SimpleReturn
impl Sync for SimpleReturn
impl Unpin for SimpleReturn
impl UnsafeUnpin for SimpleReturn
impl UnwindSafe for SimpleReturn
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