uddf_sdk/entities/samples/
builder.rs1use crate::entities::waypoint::structure::Waypoint;
2
3use super::structure::Samples;
4
5pub struct SamplesBuilder {
7 waypoints: Vec<Waypoint>,
8}
9
10impl SamplesBuilder {
11 pub fn new() -> Self {
13 SamplesBuilder {
14 waypoints: Vec::new(),
15 }
16 }
17
18 pub fn add_waypoint(mut self, waypoint: Waypoint) -> Self {
20 self.waypoints.push(waypoint);
21 self
22 }
23
24 pub fn build(self) -> Result<Samples, &'static str> {
26 Ok(Samples {
27 waypoints: self.waypoints,
28 })
29 }
30}
31
32impl Default for SamplesBuilder {
33 fn default() -> Self {
34 Self::new()
35 }
36}