Sin

Trait Sin 

Source
pub trait Sin: Sized {
    type Error: Error;

    // Required methods
    fn try_sin(self) -> Result<Self, <Self as Sin>::Error>;
    fn sin(self) -> Self;
}
Expand description

Trait for computing the sine of a number.

This trait defines methods for computing the sine of a number. It includes both a safe method that returns a Result and an unsafe method that directly returns the computed value.

§Associated Types

  • Error: The error type that is returned by the try_sin method. This type must implement the std::error::Error trait.

§Required Methods

  • try_sin: Computes the sine of the number and returns a Result. If the computation is successful, it returns Ok with the computed value. If an error occurs, it returns Err with the associated error.

  • sin: Computes the sine of the number and directly returns the computed value. In Debug mode this method may panic if the computation fails.

Required Associated Types§

Source

type Error: Error

The error type that is returned by the try_sin method.

Required Methods§

Source

fn try_sin(self) -> Result<Self, <Self as Sin>::Error>

Computes the sine of self and returns a Result.

If the computation is successful, it returns Ok with the computed value. If an error occurs, it returns Err with the associated error.

§Errors

This method returns an error if the computation fails. The error type is defined by the associated Error type.

Source

fn sin(self) -> Self

Computes and returns the sine of self.

In Debug mode this method may panic if the computation fails.

§Panics

In Debug mode this method may panic if the computation fails. It is recommended to use the try_sin method for safe computations.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Sin for f64

Source§

impl Sin for Complex<f64>

Implementors§