update examples

This commit is contained in:
Nicholas Orlowsky 2025-03-18 21:33:05 -04:00
parent 1b3f6a2f6b
commit 6426fc7afc
2 changed files with 18 additions and 6 deletions

View file

@ -6,14 +6,20 @@
//!
//! # Usage
//! ```
//! use obd2::{commands::Obd2DataRetrieval, device::Elm327, Obd2};
//! use obd2::{commands::Obd2DataRetrieval, device::{Elm327, FTDIDevice}, Obd2};
//!
//! fn main() -> Result<(), obd2::Error> {
//! let mut device = Obd2::<Elm327>::default();
//! let mut device = Obd2::<Elm327::<FTDIDevice>>::new(Elm327::new(FTDIDevice::new()?)?)?;
//! println!("VIN: {}", device.get_vin()?);
//! Ok(())
//! }
//! ```
//!
//! alternatively, you could use a serial port provided by your operating system such as
//! /dev/ttyUSB0 on unix-like systems
//! ```
//! let mut device = Obd2::<Elm327::<SerialPort>>::new(Elm327::new(SerialPort::new("/dev/ttyUSB0")?)?)?;
//! ```
#![forbid(unsafe_code)]
#![warn(missing_docs)]