Skip to content

Commit

Permalink
Add Rustdoc comments for fake transport.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Dec 4, 2024
1 parent 2d052c3 commit f4605c9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/transport/fake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ use zerocopy::{FromBytes, Immutable, IntoBytes};
/// A fake implementation of [`Transport`] for unit tests.
#[derive(Debug)]
pub struct FakeTransport<C> {
/// The type of device which the transport should claim to be for.
pub device_type: DeviceType,
/// The maximum queue size supported by the transport.
pub max_queue_size: u32,
/// The device features which should be reported by the transport.
pub device_features: u64,
/// The mutable state of the transport.
pub state: Arc<Mutex<State<C>>>,
}

Expand Down Expand Up @@ -136,13 +140,21 @@ impl<C: FromBytes + Immutable + IntoBytes> Transport for FakeTransport<C> {
}
}

/// The mutable state of a fake transport.
pub struct State<C> {
/// The status of the fake device.
pub status: DeviceStatus,
/// The features which the driver says it supports.
pub driver_features: u64,
/// The guest page size set by the driver.
pub guest_page_size: u32,
/// Whether the transport has an interrupt pending.
pub interrupt_pending: bool,
/// The state of the transport's queues.
pub queues: Vec<QueueStatus>,
/// The config generation which the transport should report.
pub config_generation: u32,
/// The state of the transport's VirtIO configuration space.
pub config_space: C,
}

Expand Down

0 comments on commit f4605c9

Please sign in to comment.