Skip to main content

IntoSeries

Trait IntoSeries 

Source
pub trait IntoSeries {
    // Required method
    fn into_series(self) -> Series;
}
Expand description

Trait for types that can be converted into a Series.

This is the primary entry-point for user data. Any function that accepts chart data should be generic over impl IntoSeries so that callers can pass slices, vectors, arrays, integer collections, or ranges without manual conversion.

Required Methods§

Source

fn into_series(self) -> Series

Converts this value into a Series.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IntoSeries for &Series

Source§

fn into_series(self) -> Series

Converts a borrowed Polars Series into a plotkit Series.

Supports numeric dtypes: Float64, Float32, Int32, Int64, UInt32, UInt64. Null values become f64::NAN.

Source§

impl IntoSeries for &Vec<f64>

Source§

fn into_series(self) -> Series

Clones the vector data into a new Series.

Source§

impl IntoSeries for &[f32]

Source§

fn into_series(self) -> Series

Converts an f32 slice into a Series by casting each element to f64.

Source§

impl IntoSeries for &[f64]

Source§

fn into_series(self) -> Series

Clones the slice data into a new Series.

Source§

impl IntoSeries for &[i32]

Source§

fn into_series(self) -> Series

Converts an i32 slice into a Series by casting each element to f64.

Source§

impl IntoSeries for Range<i32>

Source§

fn into_series(self) -> Series

Converts an integer range into a Series of f64 values.

§Examples
use plotkit_core::series::IntoSeries;

let s = (0..5).into_series();
assert_eq!(s.data, vec![0.0, 1.0, 2.0, 3.0, 4.0]);
Source§

impl IntoSeries for Series

Source§

fn into_series(self) -> Series

Converts an owned Polars Series into a plotkit Series. Delegates to the borrowed implementation.

Source§

impl IntoSeries for Vec<f32>

Source§

fn into_series(self) -> Series

Converts a Vec<f32> into a Series by casting each element to f64.

Source§

impl IntoSeries for Vec<f64>

Source§

fn into_series(self) -> Series

Zero-copy conversion from an owned Vec<f64>.

Source§

impl IntoSeries for Vec<i32>

Source§

fn into_series(self) -> Series

Converts a Vec<i32> into a Series by casting each element to f64.

Source§

impl<const N: usize> IntoSeries for &[f64; N]

Source§

fn into_series(self) -> Series

Clones a fixed-size array reference into a Series.

Source§

impl<const N: usize> IntoSeries for [f64; N]

Source§

fn into_series(self) -> Series

Converts a fixed-size array of f64 into a Series.

Implementors§

Source§

impl IntoSeries for plotkit_polars::Series