pub struct DataSeries { /* private fields */ }Expand description
Data Series representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| name | String | Yes | Max length 20 characters |
| data | Vec<DataPoint> | Yes | Min 1, Max 20 items |
§Example
use slack_messaging::blocks::data_visualization::charts::{data_points, DataSeries};
let series = DataSeries::builder()
.name("Sales")
.data(data_points(vec![
("Mon", 200),
("Tue", 120),
("Wed", 180),
("Thu", 50),
("Fri", 300)
])?)
.build()?;
let expected = serde_json::json!({
"name": "Sales",
"data": [
{ "label": "Mon", "value": 200 },
{ "label": "Tue", "value": 120 },
{ "label": "Wed", "value": 180 },
{ "label": "Thu", "value": 50 },
{ "label": "Fri", "value": 300 }
]
});
let json = serde_json::to_value(series).unwrap();
assert_eq!(json, expected);Implementations§
Source§impl DataSeries
impl DataSeries
Sourcepub fn builder() -> DataSeriesBuilder
pub fn builder() -> DataSeriesBuilder
constract DataSeriesBuilder object.
Trait Implementations§
Source§impl Clone for DataSeries
impl Clone for DataSeries
Source§fn clone(&self) -> DataSeries
fn clone(&self) -> DataSeries
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DataSeries
impl Debug for DataSeries
Source§impl PartialEq for DataSeries
impl PartialEq for DataSeries
Source§fn eq(&self, other: &DataSeries) -> bool
fn eq(&self, other: &DataSeries) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DataSeries
impl Serialize for DataSeries
impl StructuralPartialEq for DataSeries
Auto Trait Implementations§
impl Freeze for DataSeries
impl RefUnwindSafe for DataSeries
impl Send for DataSeries
impl Sync for DataSeries
impl Unpin for DataSeries
impl UnsafeUnpin for DataSeries
impl UnwindSafe for DataSeries
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