pub struct PiperBuilder { /* private fields */ }Expand description
Client 层 Piper Builder
提供链式 API 创建 Piper<Standby> 实例,自动处理平台差异和适配器选择。
§示例
use piper_client::PiperBuilder;
use std::time::Duration;
// 使用默认配置(推荐)
let robot = PiperBuilder::new().build()?;
// 指定接口
let robot = PiperBuilder::new()
.interface("can0")
.build()?;
// 完整配置
let robot = PiperBuilder::new()
.interface("can0")
.baud_rate(1_000_000)
.timeout(Duration::from_secs(5))
.build()?;
// 使用守护进程
let robot = PiperBuilder::new()
.with_daemon("/tmp/gs_usb_daemon.sock")
.build()?;Implementations§
Source§impl PiperBuilder
impl PiperBuilder
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PiperBuilder
impl RefUnwindSafe for PiperBuilder
impl Send for PiperBuilder
impl Sync for PiperBuilder
impl Unpin for PiperBuilder
impl UnwindSafe for PiperBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more