pub struct AddressRange {
    pub start: u64,
    pub end: u64,
}
Expand description

Represents a range of addresses from start to end, inclusive.

Why not use the standard RangeInclusive? RangeInclusive is not Copy, because it tries to be an iterator as well as a range (which also means it is larger than necessary). Additionally, we would also like to implement some convenience functions for our own type.

Fields§

§start: u64§end: u64

Implementations§

Creates a new AddressRange from start and end (inclusive) addresses.

Creates a new AddressRange from start extending size bytes.

Returns None if the generated range is not representable as an AddressRange.

Returns an empty range.

Returns true if this range is empty (contains no addresses).

Returns true if this range contains address.

Returns true if other is fully contained within this range.

Empty ranges are considered to be not contained by any range.

Returns true if the two ranges have any addresses in common.

Find the intersection (overlapping region) of two ranges.

If there is no intersection, the resulting AddressRange will be empty.

Returns the ranges of addresses contained in self but not in other.

The first returned range will contain the addresses in self that are less than the start of other, which will be empty if the starts of the ranges coincide.

The second returned range will contain the addresses in self that are greater than the end of other, which will be empty if the ends of the ranges coincide.

Returns the two subsets of this range split at the split_start address.

If split_start is not contained in this range, returns the original range and an empty range.

Computes the length of an AddressRange.

Returns None if the length cannot be represented in u64 (if the range is 0..=u64::MAX).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.

Custom comparison function that provides a total order over all possible AddressRange values and considers all empty ranges to be equal.

This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.