Struct z80emu::host::TsCounter

source ·
pub struct TsCounter<T: Copy>(pub Wrapping<T>);
Expand description

A simple T-states counter wrapping at 2^bitsize of T. You may refer to it as a template for implementing Clock trait methods.

Tuple Fields§

§0: Wrapping<T>

Methods from Deref<Target = Wrapping<T>>§

source

pub const MIN: Wrapping<usize> = _

source

pub const MAX: Wrapping<usize> = _

source

pub const BITS: u32 = 64u32

source

pub const MIN: Wrapping<u8> = _

source

pub const MAX: Wrapping<u8> = _

source

pub const BITS: u32 = 8u32

source

pub const MIN: Wrapping<u16> = _

source

pub const MAX: Wrapping<u16> = _

source

pub const BITS: u32 = 16u32

source

pub const MIN: Wrapping<u32> = _

source

pub const MAX: Wrapping<u32> = _

source

pub const BITS: u32 = 32u32

source

pub const MIN: Wrapping<u64> = _

source

pub const MAX: Wrapping<u64> = _

source

pub const BITS: u32 = 64u32

source

pub const MIN: Wrapping<u128> = _

source

pub const MAX: Wrapping<u128> = _

source

pub const BITS: u32 = 128u32

source

pub const MIN: Wrapping<isize> = _

source

pub const MAX: Wrapping<isize> = _

source

pub const BITS: u32 = 64u32

source

pub const MIN: Wrapping<i8> = _

source

pub const MAX: Wrapping<i8> = _

source

pub const BITS: u32 = 8u32

source

pub const MIN: Wrapping<i16> = _

source

pub const MAX: Wrapping<i16> = _

source

pub const BITS: u32 = 16u32

source

pub const MIN: Wrapping<i32> = _

source

pub const MAX: Wrapping<i32> = _

source

pub const BITS: u32 = 32u32

source

pub const MIN: Wrapping<i64> = _

source

pub const MAX: Wrapping<i64> = _

source

pub const BITS: u32 = 64u32

source

pub const MIN: Wrapping<i128> = _

source

pub const MAX: Wrapping<i128> = _

source

pub const BITS: u32 = 128u32

Trait Implementations§

source§

impl<T> Clock for TsCounter<T>
where T: Copy + PartialEq + PartialOrd + From<u8> + From<u16>, Wrapping<T>: AddAssign + Add<Output = Wrapping<T>>,

source§

fn is_past_limit(&self, limit: Self::Limit) -> bool

Returns true if self as T >= limit. Otherwise returns false.

source§

fn add_irq(&mut self, _addr: u16) -> T

Returns self after adding INT_IORQ_LOW_TS as T. Updates self by adding IRQ_ACK_CYCLE_TS to the previous value of self.

source§

fn add_no_mreq(&mut self, _addr: u16, add_ts: NonZeroU8)

Updates self by adding add_ts T-states to the previous value of self.

source§

fn add_io(&mut self, _port: u16) -> T

Returns self after adding IO_IORQ_LOW_TS as T. Updates self by adding IO_CYCLE_TS to the previous value of self.

source§

fn add_mreq(&mut self, _addr: u16) -> T

Updates self by adding MEMRW_CYCLE_TS to the previous value of self. Returns self after updating as T.

source§

fn add_m1(&mut self, _addr: u16) -> T

Updates self by adding M1_CYCLE_TS to the previous value of self. Returns self after updating as T.

source§

fn add_wait_states(&mut self, _bus: u16, wait_states: NonZeroU16)

Updates self by adding wait_states T-states to the previous value of self.

source§

fn as_timestamp(&self) -> T

Returns a copy of self as T.

§

type Limit = T

This type is being used for an arbitrary representation of the limit argument when executing instructions. See Cpu::execute_with_limit for an explanation.
§

type Timestamp = T

This type is being used for timestamping the interactions between Cpu, Io and Memory implementations. Read more
source§

impl<T: Clone + Copy> Clone for TsCounter<T>

source§

fn clone(&self) -> TsCounter<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + Copy> Debug for TsCounter<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default + Copy> Default for TsCounter<T>

source§

fn default() -> TsCounter<T>

Returns the “default value” for a type. Read more
source§

impl<T: Copy> Deref for TsCounter<T>

§

type Target = Wrapping<T>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T: Copy> DerefMut for TsCounter<T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'de, T> Deserialize<'de> for TsCounter<T>
where T: Deserialize<'de> + Copy,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Copy> From<T> for TsCounter<T>

source§

fn from(tsc: T) -> Self

Converts to this type from the input type.
source§

impl<T: Copy> From<Wrapping<T>> for TsCounter<T>

source§

fn from(tsc: Wrapping<T>) -> Self

Converts to this type from the input type.
source§

impl<T: Ord + Copy> Ord for TsCounter<T>

source§

fn cmp(&self, other: &TsCounter<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: PartialEq + Copy> PartialEq for TsCounter<T>

source§

fn eq(&self, other: &TsCounter<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd + Copy> PartialOrd for TsCounter<T>

source§

fn partial_cmp(&self, other: &TsCounter<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T> Serialize for TsCounter<T>
where T: Serialize + Copy,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Copy + Copy> Copy for TsCounter<T>

source§

impl<T: Eq + Copy> Eq for TsCounter<T>

source§

impl<T: Copy> StructuralPartialEq for TsCounter<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for TsCounter<T>
where T: RefUnwindSafe,

§

impl<T> Send for TsCounter<T>
where T: Send,

§

impl<T> Sync for TsCounter<T>
where T: Sync,

§

impl<T> Unpin for TsCounter<T>
where T: Unpin,

§

impl<T> UnwindSafe for TsCounter<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,