diff --git a/.lock b/.lock new file mode 100644 index 0000000..e69de29 diff --git a/crates.js b/crates.js new file mode 100644 index 0000000..ae84c42 --- /dev/null +++ b/crates.js @@ -0,0 +1 @@ +window.ALL_CRATES = ["polyhal"]; \ No newline at end of file diff --git a/help.html b/help.html new file mode 100644 index 0000000..3ea2452 --- /dev/null +++ b/help.html @@ -0,0 +1 @@ +Help

Rustdoc help

Back
\ No newline at end of file diff --git a/polyhal/addr/index.html b/polyhal/addr/index.html new file mode 100644 index 0000000..a92d807 --- /dev/null +++ b/polyhal/addr/index.html @@ -0,0 +1 @@ +polyhal::addr - Rust

Module polyhal::addr

source ·

Structs

\ No newline at end of file diff --git a/polyhal/addr/sidebar-items.js b/polyhal/addr/sidebar-items.js new file mode 100644 index 0000000..f064274 --- /dev/null +++ b/polyhal/addr/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["PhysAddr","PhysPage","VirtAddr","VirtPage"]}; \ No newline at end of file diff --git a/polyhal/addr/struct.PhysAddr.html b/polyhal/addr/struct.PhysAddr.html new file mode 100644 index 0000000..b924aca --- /dev/null +++ b/polyhal/addr/struct.PhysAddr.html @@ -0,0 +1,20 @@ +PhysAddr in polyhal::addr - Rust

Struct polyhal::addr::PhysAddr

source ·
#[repr(C)]
pub struct PhysAddr(/* private fields */);

Implementations§

source§

impl PhysAddr

source

pub fn addr(&self) -> usize

source

pub fn get_ptr<T>(&self) -> *const T

source

pub const fn get_mut_ptr<T>(&self) -> *mut T

source

pub fn slice_with_len<T>(&self, len: usize) -> &'static [T]

source

pub fn slice_mut_with_len<T>(&self, len: usize) -> &'static mut [T]

source

pub fn get_cstr(&self) -> &CStr

source§

impl PhysAddr

source

pub const fn new(addr: usize) -> Self

Trait Implementations§

source§

impl Clone for PhysAddr

source§

fn clone(&self) -> PhysAddr

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 Debug for PhysAddr

source§

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

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

impl Display for PhysAddr

source§

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

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

impl From<PhysAddr> for PhysPage

source§

fn from(value: PhysAddr) -> Self

Converts to this type from the input type.
source§

impl From<PhysPage> for PhysAddr

source§

fn from(value: PhysPage) -> Self

Converts to this type from the input type.
source§

impl Ord for PhysAddr

source§

fn cmp(&self, other: &PhysAddr) -> Ordering

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

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

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

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

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

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

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

impl PartialEq for PhysAddr

source§

fn eq(&self, other: &PhysAddr) -> 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 PartialOrd for PhysAddr

source§

fn partial_cmp(&self, other: &PhysAddr) -> 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 Copy for PhysAddr

source§

impl Eq for PhysAddr

source§

impl StructuralEq for PhysAddr

source§

impl StructuralPartialEq for PhysAddr

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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> ToString for Twhere + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/addr/struct.PhysPage.html b/polyhal/addr/struct.PhysPage.html new file mode 100644 index 0000000..f712723 --- /dev/null +++ b/polyhal/addr/struct.PhysPage.html @@ -0,0 +1,20 @@ +PhysPage in polyhal::addr - Rust

Struct polyhal::addr::PhysPage

source ·
pub struct PhysPage(/* private fields */);

Implementations§

source§

impl PhysPage

source

pub const fn new(ppn: usize) -> Self

source

pub const fn from_addr(addr: usize) -> Self

source

pub const fn to_addr(&self) -> usize

source

pub const fn get_buffer(&self) -> &'static mut [u8]

source

pub fn copy_value_from_another(&self, ppn: PhysPage)

source

pub fn drop_clear(&self)

source

pub fn as_num(&self) -> usize

Trait Implementations§

source§

impl Add<usize> for PhysPage

§

type Output = PhysPage

The resulting type after applying the + operator.
source§

fn add(self, rhs: usize) -> Self::Output

Performs the + operation. Read more
source§

impl Add for PhysPage

§

type Output = PhysPage

The resulting type after applying the + operator.
source§

fn add(self, rhs: PhysPage) -> Self::Output

Performs the + operation. Read more
source§

impl Clone for PhysPage

source§

fn clone(&self) -> PhysPage

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 Debug for PhysPage

source§

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

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

impl Display for PhysPage

source§

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

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

impl From<PhysAddr> for PhysPage

source§

fn from(value: PhysAddr) -> Self

Converts to this type from the input type.
source§

impl From<PhysPage> for PhysAddr

source§

fn from(value: PhysPage) -> Self

Converts to this type from the input type.
source§

impl From<PhysPage> for usize

source§

fn from(value: PhysPage) -> Self

Converts to this type from the input type.
source§

impl From<usize> for PhysPage

source§

fn from(value: usize) -> Self

Converts to this type from the input type.
source§

impl Ord for PhysPage

source§

fn cmp(&self, other: &PhysPage) -> Ordering

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

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

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

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

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

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

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

impl PartialEq for PhysPage

source§

fn eq(&self, other: &PhysPage) -> 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 PartialOrd for PhysPage

source§

fn partial_cmp(&self, other: &PhysPage) -> 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 Copy for PhysPage

source§

impl Eq for PhysPage

source§

impl StructuralEq for PhysPage

source§

impl StructuralPartialEq for PhysPage

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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> ToString for Twhere + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/addr/struct.VirtAddr.html b/polyhal/addr/struct.VirtAddr.html new file mode 100644 index 0000000..d608959 --- /dev/null +++ b/polyhal/addr/struct.VirtAddr.html @@ -0,0 +1,21 @@ +VirtAddr in polyhal::addr - Rust

Struct polyhal::addr::VirtAddr

source ·
pub struct VirtAddr(/* private fields */);

Implementations§

source§

impl VirtAddr

source

pub fn addr(&self) -> usize

source

pub fn get_ptr<T>(&self) -> *const T

source

pub fn get_mut_ptr<T>(&self) -> *mut T

source

pub fn get_ref<T>(&self) -> &'static T

source

pub fn get_mut_ref<T>(&self) -> &'static mut T

source

pub fn slice_with_len<T>(&self, len: usize) -> &'static [T]

source

pub fn slice_mut_with_len<T>(&self, len: usize) -> &'static mut [T]

source

pub fn slice_until<T>(&self, is_valid: fn(_: T) -> bool) -> &'static mut [T]

source

pub fn get_cstr(&self) -> &CStr

source

pub fn floor(&self) -> Self

source

pub fn ceil(&self) -> Self

source§

impl VirtAddr

source

pub const fn new(addr: usize) -> Self

source§

impl VirtAddr

source

pub fn pn_offest(&self, n: usize) -> usize

Get n level page table offset of the given virtual address

+

Trait Implementations§

source§

impl Clone for VirtAddr

source§

fn clone(&self) -> VirtAddr

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 Debug for VirtAddr

source§

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

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

impl Display for VirtAddr

source§

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

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

impl From<VirtAddr> for VirtPage

source§

fn from(value: VirtAddr) -> Self

Converts to this type from the input type.
source§

impl From<VirtAddr> for usize

source§

fn from(value: VirtAddr) -> Self

Converts to this type from the input type.
source§

impl From<VirtPage> for VirtAddr

source§

fn from(value: VirtPage) -> Self

Converts to this type from the input type.
source§

impl From<usize> for VirtAddr

source§

fn from(value: usize) -> Self

Converts to this type from the input type.
source§

impl Ord for VirtAddr

source§

fn cmp(&self, other: &VirtAddr) -> Ordering

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

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

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

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

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

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

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

impl PartialEq for VirtAddr

source§

fn eq(&self, other: &VirtAddr) -> 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 PartialOrd for VirtAddr

source§

fn partial_cmp(&self, other: &VirtAddr) -> 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 Copy for VirtAddr

source§

impl Eq for VirtAddr

source§

impl StructuralEq for VirtAddr

source§

impl StructuralPartialEq for VirtAddr

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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> ToString for Twhere + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/addr/struct.VirtPage.html b/polyhal/addr/struct.VirtPage.html new file mode 100644 index 0000000..68070aa --- /dev/null +++ b/polyhal/addr/struct.VirtPage.html @@ -0,0 +1,21 @@ +VirtPage in polyhal::addr - Rust

Struct polyhal::addr::VirtPage

source ·
pub struct VirtPage(/* private fields */);

Implementations§

source§

impl VirtPage

source

pub const fn new(vpn: usize) -> Self

source

pub const fn from_addr(addr: usize) -> Self

source

pub const fn to_addr(&self) -> usize

source§

impl VirtPage

source

pub fn pn_index(&self, n: usize) -> usize

Get n level page table index of the given virtual address

+

Trait Implementations§

source§

impl Add<usize> for VirtPage

§

type Output = VirtPage

The resulting type after applying the + operator.
source§

fn add(self, rhs: usize) -> Self::Output

Performs the + operation. Read more
source§

impl Clone for VirtPage

source§

fn clone(&self) -> VirtPage

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 Debug for VirtPage

source§

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

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

impl Display for VirtPage

source§

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

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

impl From<VirtAddr> for VirtPage

source§

fn from(value: VirtAddr) -> Self

Converts to this type from the input type.
source§

impl From<VirtPage> for VirtAddr

source§

fn from(value: VirtPage) -> Self

Converts to this type from the input type.
source§

impl From<usize> for VirtPage

source§

fn from(value: usize) -> Self

Converts to this type from the input type.
source§

impl Ord for VirtPage

source§

fn cmp(&self, other: &VirtPage) -> Ordering

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

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

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

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

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

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

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

impl PartialEq for VirtPage

source§

fn eq(&self, other: &VirtPage) -> 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 PartialOrd for VirtPage

source§

fn partial_cmp(&self, other: &VirtPage) -> 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 Copy for VirtPage

source§

impl Eq for VirtPage

source§

impl StructuralEq for VirtPage

source§

impl StructuralPartialEq for VirtPage

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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> ToString for Twhere + T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/all.html b/polyhal/all.html new file mode 100644 index 0000000..0e78914 --- /dev/null +++ b/polyhal/all.html @@ -0,0 +1 @@ +List of all items in this crate

List of all items

Structs

Enums

Traits

Attribute Macros

Functions

Constants

\ No newline at end of file diff --git a/polyhal/api/index.html b/polyhal/api/index.html new file mode 100644 index 0000000..d23621f --- /dev/null +++ b/polyhal/api/index.html @@ -0,0 +1 @@ +polyhal::api - Rust

Module polyhal::api

source ·
\ No newline at end of file diff --git a/polyhal/api/sidebar-items.js b/polyhal/api/sidebar-items.js new file mode 100644 index 0000000..5244ce0 --- /dev/null +++ b/polyhal/api/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {}; \ No newline at end of file diff --git a/polyhal/attr.arch_entry.html b/polyhal/attr.arch_entry.html new file mode 100644 index 0000000..b384295 --- /dev/null +++ b/polyhal/attr.arch_entry.html @@ -0,0 +1 @@ +arch_entry in polyhal - Rust

Attribute Macro polyhal::arch_entry

#[arch_entry]
\ No newline at end of file diff --git a/polyhal/attr.arch_interrupt.html b/polyhal/attr.arch_interrupt.html new file mode 100644 index 0000000..35c2514 --- /dev/null +++ b/polyhal/attr.arch_interrupt.html @@ -0,0 +1 @@ +arch_interrupt in polyhal - Rust

Attribute Macro polyhal::arch_interrupt

#[arch_interrupt]
\ No newline at end of file diff --git a/polyhal/constant.MULTI_CORE_AREA.html b/polyhal/constant.MULTI_CORE_AREA.html new file mode 100644 index 0000000..f29a5fe --- /dev/null +++ b/polyhal/constant.MULTI_CORE_AREA.html @@ -0,0 +1,7 @@ +MULTI_CORE_AREA in polyhal - Rust

Constant polyhal::MULTI_CORE_AREA

source ·
pub const MULTI_CORE_AREA: usize = 0xFFFF_FFC2_0000_0000;
Expand description

Every core has a unique area of memory. +Just using pagetable to map multi core area. +Area size: 0x100_0000 (16MBytes)

+

First Area is 0xFFFF_FFC2_0000_0000 +Next Area is 0xFFFF_FFC2_0100_0000 +Others Same as This, so it will support 16 * 16 = 256 cores (Only auxiliary Harts).

+
\ No newline at end of file diff --git a/polyhal/constant.MULTI_CORE_AREA_SIZE.html b/polyhal/constant.MULTI_CORE_AREA_SIZE.html new file mode 100644 index 0000000..efb1657 --- /dev/null +++ b/polyhal/constant.MULTI_CORE_AREA_SIZE.html @@ -0,0 +1 @@ +MULTI_CORE_AREA_SIZE in polyhal - Rust
pub const MULTI_CORE_AREA_SIZE: usize = 0x100_0000;
\ No newline at end of file diff --git a/polyhal/constant.PAGE_SIZE.html b/polyhal/constant.PAGE_SIZE.html new file mode 100644 index 0000000..95b165c --- /dev/null +++ b/polyhal/constant.PAGE_SIZE.html @@ -0,0 +1 @@ +PAGE_SIZE in polyhal - Rust

Constant polyhal::PAGE_SIZE

source ·
pub const PAGE_SIZE: usize = PageTable::PAGE_SIZE; // 4_096usize
\ No newline at end of file diff --git a/polyhal/constant.SIG_RETURN_ADDR.html b/polyhal/constant.SIG_RETURN_ADDR.html new file mode 100644 index 0000000..640aa39 --- /dev/null +++ b/polyhal/constant.SIG_RETURN_ADDR.html @@ -0,0 +1 @@ +SIG_RETURN_ADDR in polyhal - Rust

Constant polyhal::SIG_RETURN_ADDR

source ·
pub const SIG_RETURN_ADDR: usize = 0xFFFF_FFC1_0000_0000;
\ No newline at end of file diff --git a/polyhal/constant.USER_VADDR_END.html b/polyhal/constant.USER_VADDR_END.html new file mode 100644 index 0000000..0d23487 --- /dev/null +++ b/polyhal/constant.USER_VADDR_END.html @@ -0,0 +1 @@ +USER_VADDR_END in polyhal - Rust

Constant polyhal::USER_VADDR_END

source ·
pub const USER_VADDR_END: usize = PageTable::USER_VADDR_END; // 549_755_813_887usize
\ No newline at end of file diff --git a/polyhal/constant.VIRT_ADDR_START.html b/polyhal/constant.VIRT_ADDR_START.html new file mode 100644 index 0000000..9837a35 --- /dev/null +++ b/polyhal/constant.VIRT_ADDR_START.html @@ -0,0 +1 @@ +VIRT_ADDR_START in polyhal - Rust

Constant polyhal::VIRT_ADDR_START

source ·
pub const VIRT_ADDR_START: usize = 0xffff_ffc0_0000_0000;
\ No newline at end of file diff --git a/polyhal/consts/constant.STACK_SIZE.html b/polyhal/consts/constant.STACK_SIZE.html new file mode 100644 index 0000000..12152b8 --- /dev/null +++ b/polyhal/consts/constant.STACK_SIZE.html @@ -0,0 +1,3 @@ +STACK_SIZE in polyhal::consts - Rust

Constant polyhal::consts::STACK_SIZE

source ·
pub const STACK_SIZE: usize = 0x8_0000;
Expand description

Boot Stack Size. +TODO: reduce the boot stack size. Map stack in boot step.

+
\ No newline at end of file diff --git a/polyhal/consts/constant.TRAPFRAME_SIZE.html b/polyhal/consts/constant.TRAPFRAME_SIZE.html new file mode 100644 index 0000000..04859ee --- /dev/null +++ b/polyhal/consts/constant.TRAPFRAME_SIZE.html @@ -0,0 +1,2 @@ +TRAPFRAME_SIZE in polyhal::consts - Rust

Constant polyhal::consts::TRAPFRAME_SIZE

source ·
pub const TRAPFRAME_SIZE: usize = _; // 288usize
Expand description

The size of the trap frame(diffent in each architecture.).

+
\ No newline at end of file diff --git a/polyhal/consts/index.html b/polyhal/consts/index.html new file mode 100644 index 0000000..ce0c75d --- /dev/null +++ b/polyhal/consts/index.html @@ -0,0 +1,2 @@ +polyhal::consts - Rust

Module polyhal::consts

source ·

Constants

  • Boot Stack Size. +TODO: reduce the boot stack size. Map stack in boot step.
  • The size of the trap frame(diffent in each architecture.).
\ No newline at end of file diff --git a/polyhal/consts/sidebar-items.js b/polyhal/consts/sidebar-items.js new file mode 100644 index 0000000..e67ad84 --- /dev/null +++ b/polyhal/consts/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"constant":["STACK_SIZE","TRAPFRAME_SIZE"]}; \ No newline at end of file diff --git a/polyhal/currrent_arch/consts/constant.MULTI_CORE_AREA.html b/polyhal/currrent_arch/consts/constant.MULTI_CORE_AREA.html new file mode 100644 index 0000000..c753cc0 --- /dev/null +++ b/polyhal/currrent_arch/consts/constant.MULTI_CORE_AREA.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/constant.MULTI_CORE_AREA.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/consts/constant.MULTI_CORE_AREA_SIZE.html b/polyhal/currrent_arch/consts/constant.MULTI_CORE_AREA_SIZE.html new file mode 100644 index 0000000..a56cf91 --- /dev/null +++ b/polyhal/currrent_arch/consts/constant.MULTI_CORE_AREA_SIZE.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/constant.MULTI_CORE_AREA_SIZE.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/consts/constant.SIG_RETURN_ADDR.html b/polyhal/currrent_arch/consts/constant.SIG_RETURN_ADDR.html new file mode 100644 index 0000000..c2b19ca --- /dev/null +++ b/polyhal/currrent_arch/consts/constant.SIG_RETURN_ADDR.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/constant.SIG_RETURN_ADDR.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/consts/constant.VIRT_ADDR_START.html b/polyhal/currrent_arch/consts/constant.VIRT_ADDR_START.html new file mode 100644 index 0000000..d4d0b77 --- /dev/null +++ b/polyhal/currrent_arch/consts/constant.VIRT_ADDR_START.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/constant.VIRT_ADDR_START.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/context/struct.TrapFrame.html b/polyhal/currrent_arch/context/struct.TrapFrame.html new file mode 100644 index 0000000..b8e1efc --- /dev/null +++ b/polyhal/currrent_arch/context/struct.TrapFrame.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/struct.TrapFrame.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/entry/fn.kernel_page_table.html b/polyhal/currrent_arch/entry/fn.kernel_page_table.html new file mode 100644 index 0000000..4bccbc4 --- /dev/null +++ b/polyhal/currrent_arch/entry/fn.kernel_page_table.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.kernel_page_table.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/entry/fn.switch_to_kernel_page_table.html b/polyhal/currrent_arch/entry/fn.switch_to_kernel_page_table.html new file mode 100644 index 0000000..d2d3964 --- /dev/null +++ b/polyhal/currrent_arch/entry/fn.switch_to_kernel_page_table.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.switch_to_kernel_page_table.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/fn.arch_init.html b/polyhal/currrent_arch/fn.arch_init.html new file mode 100644 index 0000000..831aedc --- /dev/null +++ b/polyhal/currrent_arch/fn.arch_init.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../polyhal/fn.arch_init.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/fn.hart_id.html b/polyhal/currrent_arch/fn.hart_id.html new file mode 100644 index 0000000..ec890e1 --- /dev/null +++ b/polyhal/currrent_arch/fn.hart_id.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../polyhal/fn.hart_id.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/fn.wfi.html b/polyhal/currrent_arch/fn.wfi.html new file mode 100644 index 0000000..707f17f --- /dev/null +++ b/polyhal/currrent_arch/fn.wfi.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../polyhal/fn.wfi.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/interrupt/fn.disable_irq.html b/polyhal/currrent_arch/interrupt/fn.disable_irq.html new file mode 100644 index 0000000..984f84a --- /dev/null +++ b/polyhal/currrent_arch/interrupt/fn.disable_irq.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.disable_irq.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/interrupt/fn.enable_external_irq.html b/polyhal/currrent_arch/interrupt/fn.enable_external_irq.html new file mode 100644 index 0000000..0be2c67 --- /dev/null +++ b/polyhal/currrent_arch/interrupt/fn.enable_external_irq.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.enable_external_irq.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/interrupt/fn.enable_irq.html b/polyhal/currrent_arch/interrupt/fn.enable_irq.html new file mode 100644 index 0000000..c8ec189 --- /dev/null +++ b/polyhal/currrent_arch/interrupt/fn.enable_irq.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.enable_irq.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/interrupt/fn.run_user_task.html b/polyhal/currrent_arch/interrupt/fn.run_user_task.html new file mode 100644 index 0000000..4c347a8 --- /dev/null +++ b/polyhal/currrent_arch/interrupt/fn.run_user_task.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.run_user_task.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/interrupt/fn.run_user_task_forever.html b/polyhal/currrent_arch/interrupt/fn.run_user_task_forever.html new file mode 100644 index 0000000..7f25927 --- /dev/null +++ b/polyhal/currrent_arch/interrupt/fn.run_user_task_forever.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.run_user_task_forever.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/kcontext/fn.context_switch.html b/polyhal/currrent_arch/kcontext/fn.context_switch.html new file mode 100644 index 0000000..1447ac8 --- /dev/null +++ b/polyhal/currrent_arch/kcontext/fn.context_switch.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.context_switch.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/kcontext/fn.context_switch_pt.html b/polyhal/currrent_arch/kcontext/fn.context_switch_pt.html new file mode 100644 index 0000000..17ad13d --- /dev/null +++ b/polyhal/currrent_arch/kcontext/fn.context_switch_pt.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.context_switch_pt.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/kcontext/fn.read_current_tp.html b/polyhal/currrent_arch/kcontext/fn.read_current_tp.html new file mode 100644 index 0000000..442ec41 --- /dev/null +++ b/polyhal/currrent_arch/kcontext/fn.read_current_tp.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.read_current_tp.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/kcontext/struct.KContext.html b/polyhal/currrent_arch/kcontext/struct.KContext.html new file mode 100644 index 0000000..0d85e1c --- /dev/null +++ b/polyhal/currrent_arch/kcontext/struct.KContext.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/struct.KContext.html...

+ + + \ No newline at end of file diff --git a/polyhal/currrent_arch/sbi/fn.shutdown.html b/polyhal/currrent_arch/sbi/fn.shutdown.html new file mode 100644 index 0000000..c61bd41 --- /dev/null +++ b/polyhal/currrent_arch/sbi/fn.shutdown.html @@ -0,0 +1,11 @@ + + + + + Redirection + + +

Redirecting to ../../../polyhal/fn.shutdown.html...

+ + + \ No newline at end of file diff --git a/polyhal/debug/index.html b/polyhal/debug/index.html new file mode 100644 index 0000000..abc2767 --- /dev/null +++ b/polyhal/debug/index.html @@ -0,0 +1,3 @@ +polyhal::debug - Rust

Module polyhal::debug

source ·

Structs

  • This is a console for debugging, +If you want to use this logging +You need to use like this:
\ No newline at end of file diff --git a/polyhal/debug/sidebar-items.js b/polyhal/debug/sidebar-items.js new file mode 100644 index 0000000..8ca1933 --- /dev/null +++ b/polyhal/debug/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["DebugConsole"]}; \ No newline at end of file diff --git a/polyhal/debug/struct.DebugConsole.html b/polyhal/debug/struct.DebugConsole.html new file mode 100644 index 0000000..333310d --- /dev/null +++ b/polyhal/debug/struct.DebugConsole.html @@ -0,0 +1,19 @@ +DebugConsole in polyhal::debug - Rust

Struct polyhal::debug::DebugConsole

source ·
pub struct DebugConsole;
Expand description

This is a console for debugging, +If you want to use this logging +You need to use like this:

+
Put a char to output device(always uart)
+
DebugConsole::putchar(b'3');
+

Get a char from input device(always uart)

+
DebugConsole::getchar();
+

Implementations§

Trait Implementations§

source§

impl Write for DebugConsole

source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write +succeeded. Read more
1.1.0 · source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/enum.KContextArgs.html b/polyhal/enum.KContextArgs.html new file mode 100644 index 0000000..a102f5a --- /dev/null +++ b/polyhal/enum.KContextArgs.html @@ -0,0 +1,41 @@ +KContextArgs in polyhal - Rust
pub enum KContextArgs {
+    KSP,
+    KTP,
+    KPC,
+}
Expand description

Kernel Context Arg Type.

+

Using this by Index and IndexMut trait bound on KContext.

+

Variants§

§

KSP

Kernel Stack Pointer

+
§

KTP

Kernel Thread Pointer

+
§

KPC

Kernel Program Counter

+

Trait Implementations§

source§

impl Debug for KContextArgs

source§

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

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

impl Index<KContextArgs> for KContext

Indexing operations for KContext

+

Using it just like the Vector.

+

#[derive(Debug)] +pub enum KContextArgs { +/// Kernel Stack Pointer +KSP, +/// Kernel Thread Pointer +KTP, +/// Kernel Program Counter +KPC +}

+

etc. Get reg of the kernel stack:

+

let ksp = KContextKContextArgs::KSP +let kpc = KContextKContextArgs::KPC +let ktp = KContextKContextArgs::KTP

+
§

type Output = usize

The returned type after indexing.
source§

fn index(&self, index: KContextArgs) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<KContextArgs> for KContext

Indexing Mutable operations for KContext

+

Using it just like the Vector.

+

etc. Change the value of the kernel Context using IndexMut

+

KContextKContextArgs::KSP = ksp; +KContextKContextArgs::KPC = kpc; +KContextKContextArgs::KTP = ktp;

+
source§

fn index_mut(&mut self, index: KContextArgs) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/enum.TrapFrameArgs.html b/polyhal/enum.TrapFrameArgs.html new file mode 100644 index 0000000..ed55264 --- /dev/null +++ b/polyhal/enum.TrapFrameArgs.html @@ -0,0 +1,23 @@ +TrapFrameArgs in polyhal - Rust
pub enum TrapFrameArgs {
+    SEPC,
+    RA,
+    SP,
+    RET,
+    ARG0,
+    ARG1,
+    ARG2,
+    TLS,
+    SYSCALL,
+}
Expand description

Trap Frame Arg Type

+

Using this by Index and IndexMut trait bound on TrapFrame

+

Variants§

§

SEPC

§

RA

§

SP

§

RET

§

ARG0

§

ARG1

§

ARG2

§

TLS

§

SYSCALL

Trait Implementations§

source§

impl Debug for TrapFrameArgs

source§

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

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

impl Index<TrapFrameArgs> for TrapFrame

§

type Output = usize

The returned type after indexing.
source§

fn index(&self, index: TrapFrameArgs) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<TrapFrameArgs> for TrapFrame

source§

fn index_mut(&mut self, index: TrapFrameArgs) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/enum.TrapType.html b/polyhal/enum.TrapType.html new file mode 100644 index 0000000..c905331 --- /dev/null +++ b/polyhal/enum.TrapType.html @@ -0,0 +1,22 @@ +TrapType in polyhal - Rust

Enum polyhal::TrapType

source ·
pub enum TrapType {
+    Breakpoint,
+    UserEnvCall,
+    Time,
+    Unknown,
+    SupervisorExternal,
+    StorePageFault(usize),
+    LoadPageFault(usize),
+    InstructionPageFault(usize),
+    IllegalInstruction(usize),
+}

Variants§

§

Breakpoint

§

UserEnvCall

§

Time

§

Unknown

§

SupervisorExternal

§

StorePageFault(usize)

§

LoadPageFault(usize)

§

InstructionPageFault(usize)

§

IllegalInstruction(usize)

Trait Implementations§

source§

impl Clone for TrapType

source§

fn clone(&self) -> TrapType

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 Debug for TrapType

source§

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

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

impl Copy for TrapType

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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 Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/fn.arch_init.html b/polyhal/fn.arch_init.html new file mode 100644 index 0000000..729843d --- /dev/null +++ b/polyhal/fn.arch_init.html @@ -0,0 +1 @@ +arch_init in polyhal - Rust

Function polyhal::arch_init

source ·
pub fn arch_init()
\ No newline at end of file diff --git a/polyhal/fn.context_switch.html b/polyhal/fn.context_switch.html new file mode 100644 index 0000000..12d0c25 --- /dev/null +++ b/polyhal/fn.context_switch.html @@ -0,0 +1,6 @@ +context_switch in polyhal - Rust

Function polyhal::context_switch

source ·
pub unsafe extern "C" fn context_switch(
+    from: *mut KContext,
+    to: *const KContext
+)
Expand description

Context Switch

+

Save the context of current task and switch to new task.

+
\ No newline at end of file diff --git a/polyhal/fn.context_switch_pt.html b/polyhal/fn.context_switch_pt.html new file mode 100644 index 0000000..18904bd --- /dev/null +++ b/polyhal/fn.context_switch_pt.html @@ -0,0 +1,7 @@ +context_switch_pt in polyhal - Rust

Function polyhal::context_switch_pt

source ·
pub unsafe extern "C" fn context_switch_pt(
+    from: *mut KContext,
+    to: *const KContext,
+    pt_token: PageTable
+)
Expand description

Context Switch With Page Table

+

Save the context of current task and switch to new task.

+
\ No newline at end of file diff --git a/polyhal/fn.disable_irq.html b/polyhal/fn.disable_irq.html new file mode 100644 index 0000000..3646193 --- /dev/null +++ b/polyhal/fn.disable_irq.html @@ -0,0 +1 @@ +disable_irq in polyhal - Rust

Function polyhal::disable_irq

source ·
pub fn disable_irq()
\ No newline at end of file diff --git a/polyhal/fn.enable_external_irq.html b/polyhal/fn.enable_external_irq.html new file mode 100644 index 0000000..e60fefd --- /dev/null +++ b/polyhal/fn.enable_external_irq.html @@ -0,0 +1 @@ +enable_external_irq in polyhal - Rust
pub fn enable_external_irq()
\ No newline at end of file diff --git a/polyhal/fn.enable_irq.html b/polyhal/fn.enable_irq.html new file mode 100644 index 0000000..5763948 --- /dev/null +++ b/polyhal/fn.enable_irq.html @@ -0,0 +1 @@ +enable_irq in polyhal - Rust

Function polyhal::enable_irq

source ·
pub fn enable_irq()
\ No newline at end of file diff --git a/polyhal/fn.get_cpu_num.html b/polyhal/fn.get_cpu_num.html new file mode 100644 index 0000000..5a93b5a --- /dev/null +++ b/polyhal/fn.get_cpu_num.html @@ -0,0 +1,2 @@ +get_cpu_num in polyhal - Rust

Function polyhal::get_cpu_num

source ·
pub fn get_cpu_num() -> usize
Expand description

Get the number of cpus

+
\ No newline at end of file diff --git a/polyhal/fn.get_fdt.html b/polyhal/fn.get_fdt.html new file mode 100644 index 0000000..989e31e --- /dev/null +++ b/polyhal/fn.get_fdt.html @@ -0,0 +1,2 @@ +get_fdt in polyhal - Rust

Function polyhal::get_fdt

source ·
pub fn get_fdt() -> Option<Fdt<'static>>
Expand description

Get the fdt

+
\ No newline at end of file diff --git a/polyhal/fn.get_mem_areas.html b/polyhal/fn.get_mem_areas.html new file mode 100644 index 0000000..5440f04 --- /dev/null +++ b/polyhal/fn.get_mem_areas.html @@ -0,0 +1,2 @@ +get_mem_areas in polyhal - Rust

Function polyhal::get_mem_areas

source ·
pub fn get_mem_areas() -> Vec<(usize, usize)>
Expand description

Get the memory area, this function should be called after initialization

+
\ No newline at end of file diff --git a/polyhal/fn.hart_id.html b/polyhal/fn.hart_id.html new file mode 100644 index 0000000..eb8defc --- /dev/null +++ b/polyhal/fn.hart_id.html @@ -0,0 +1 @@ +hart_id in polyhal - Rust

Function polyhal::hart_id

source ·
pub fn hart_id() -> usize
\ No newline at end of file diff --git a/polyhal/fn.init.html b/polyhal/fn.init.html new file mode 100644 index 0000000..3470863 --- /dev/null +++ b/polyhal/fn.init.html @@ -0,0 +1,3 @@ +init in polyhal - Rust

Function polyhal::init

source ·
pub fn init(page_alloc: &'static dyn PageAlloc)
Expand description

Init arch with page allocator, like log crate +Please initialize the allocator before calling this function.

+
\ No newline at end of file diff --git a/polyhal/fn.kernel_page_table.html b/polyhal/fn.kernel_page_table.html new file mode 100644 index 0000000..5f42a69 --- /dev/null +++ b/polyhal/fn.kernel_page_table.html @@ -0,0 +1 @@ +kernel_page_table in polyhal - Rust

Function polyhal::kernel_page_table

source ·
pub fn kernel_page_table() -> PageTable
\ No newline at end of file diff --git a/polyhal/fn.read_current_tp.html b/polyhal/fn.read_current_tp.html new file mode 100644 index 0000000..168999a --- /dev/null +++ b/polyhal/fn.read_current_tp.html @@ -0,0 +1 @@ +read_current_tp in polyhal - Rust

Function polyhal::read_current_tp

source ·
pub extern "C" fn read_current_tp() -> usize
\ No newline at end of file diff --git a/polyhal/fn.run_user_task.html b/polyhal/fn.run_user_task.html new file mode 100644 index 0000000..102fd97 --- /dev/null +++ b/polyhal/fn.run_user_task.html @@ -0,0 +1,2 @@ +run_user_task in polyhal - Rust

Function polyhal::run_user_task

source ·
pub fn run_user_task(context: &mut TrapFrame) -> Option<()>
Expand description

Return Some(()) if it was interrupt by syscall, otherwise None.

+
\ No newline at end of file diff --git a/polyhal/fn.run_user_task_forever.html b/polyhal/fn.run_user_task_forever.html new file mode 100644 index 0000000..8b5ce92 --- /dev/null +++ b/polyhal/fn.run_user_task_forever.html @@ -0,0 +1 @@ +run_user_task_forever in polyhal - Rust
pub fn run_user_task_forever(context: &mut TrapFrame) -> !
\ No newline at end of file diff --git a/polyhal/fn.shutdown.html b/polyhal/fn.shutdown.html new file mode 100644 index 0000000..0694339 --- /dev/null +++ b/polyhal/fn.shutdown.html @@ -0,0 +1,2 @@ +shutdown in polyhal - Rust

Function polyhal::shutdown

source ·
pub fn shutdown() -> !
Expand description

调用 SBI_SHUTDOWN 来关闭操作系统(直接退出 QEMU)

+
\ No newline at end of file diff --git a/polyhal/fn.switch_to_kernel_page_table.html b/polyhal/fn.switch_to_kernel_page_table.html new file mode 100644 index 0000000..9511b47 --- /dev/null +++ b/polyhal/fn.switch_to_kernel_page_table.html @@ -0,0 +1 @@ +switch_to_kernel_page_table in polyhal - Rust
pub fn switch_to_kernel_page_table()
\ No newline at end of file diff --git a/polyhal/fn.wfi.html b/polyhal/fn.wfi.html new file mode 100644 index 0000000..492fdc4 --- /dev/null +++ b/polyhal/fn.wfi.html @@ -0,0 +1 @@ +wfi in polyhal - Rust

Function polyhal::wfi

source ·
pub fn wfi()
\ No newline at end of file diff --git a/polyhal/index.html b/polyhal/index.html new file mode 100644 index 0000000..7d120e6 --- /dev/null +++ b/polyhal/index.html @@ -0,0 +1,103 @@ +polyhal - Rust

Crate polyhal

source ·
Expand description

This is a crate to help you supporting multiple platforms.

+

If you want to use this crate, you should implement the following trait in your code.

+ +
/// impl
+pub struct PageAllocImpl;
+
+impl PageAlloc for PageAllocImpl {
+    fn alloc(&self) -> PhysPage {
+        frame_alloc()
+    }
+
+    fn dealloc(&self, ppn: PhysPage) {
+        frame::frame_dealloc(ppn)
+    }
+}
+
+/// kernel interrupt
+#[polyhal::arch_interrupt]
+fn kernel_interrupt(ctx: &mut TrapFrame, trap_type: TrapType) {
+    // println!("trap_type @ {:x?} {:#x?}", trap_type, ctx);
+    match trap_type {
+        Breakpoint => return,
+        UserEnvCall => {
+            // jump to next instruction anyway
+            ctx.syscall_ok();
+            log::info!("Handle a syscall");
+        }
+        StorePageFault(_paddr) | LoadPageFault(_paddr) | InstructionPageFault(_paddr) => {
+            log::info!("page fault");
+        }
+        IllegalInstruction(_) => {
+            log::info!("illegal instruction");
+        }
+        Time => {
+            log::info!("Timer");
+        }
+        _ => {
+            log::warn!("unsuspended trap type: {:?}", trap_type);
+        }
+    }
+}
+
+#[polyhal::arch_entry]
+/// kernel main function, entry point.
+fn main(hartid: usize) {
+    if hartid != 0 {
+        return;
+    }
+
+    println!("[kernel] Hello, world!");
+    allocator::init_allocator();
+    logging::init(Some("trace"));
+    println!("init logging");
+
+    // Init page alloc for polyhal
+    polyhal::init(&PageAllocImpl);
+
+    polyhal::init_interrupt();
+
+    get_mem_areas().into_iter().for_each(|(start, size)| {
+        println!("init memory region {:#x} - {:#x}", start, start + size);
+        frame::add_frame_range(start, start + size);
+    });
+    panic!("end of rust_main!");
+}
+
+

The main(hardid: usize) is the entry point.

+

You can find details in the example.

+

In this crate you can find some interfaces to use. +These interfaces are classified into some structures.

+

PhysPage: PhysicalPage And its associated functions.

+

PhysAddr: PhysicalAddr And its associated functions.

+

VirtPage: VirtualPage And its associated functions.

+

VirtAddr: VirtualAddr And its associated functions.

+

IRQ: Interrupt ReQuest management, includes enable and disable.

+

Barrier: Memory barrier operations.

+

MultiCore: MultiCore operations. Now only multicore::MultiCore::boot_all is available.

+

PageTable: PageTable and its associated functions.

+

MappingFlags: MappingFlags, This is an abstraction of pagetable flags.

+

TLB: TLB operations.

+

PageTableWrapper: PageTableWrapper. It will dealloc all pagetable leaf when it was dropping.

+

Time: Time and its associated functions.

+

Instruction: Some platform instruction.

+

There also provides a debugging console(recommanded only for debugging).

+

DebugConsole: A console for debugging.

+

This crate provides a TrapFrame, you can operate it through index with TrapFrameArgs.

+

If you are using kernel task. You should to enable feature kcontext. +Then you can use kernel task context structure KContext, and manipulate it with KContextArgs.

+

You can switch kcontext through context_switch_pt or context_switch

+

There are also some consts.

+

VIRT_ADDR_START: This is a higher half kernel offset address. +USER_VADDR_END: End of the user address range. +PAGE_SIZE: The size of the page.

+

You can get some device information using the functions below. +get_mem_areas: Get the avaliable memorys. +get_fdt: Get the Fdt structure(fdt is a rust dtb operation crate). +get_cpu_num: Get the number of cpus.

+

TIPS: You should have finished init before using get_mem_areas and get_fdt.

+

Re-exports

  • pub use percpu;

Modules

Structs

Enums

Constants

Traits

Functions

Attribute Macros

\ No newline at end of file diff --git a/polyhal/instruction/index.html b/polyhal/instruction/index.html new file mode 100644 index 0000000..e3201ed --- /dev/null +++ b/polyhal/instruction/index.html @@ -0,0 +1,2 @@ +polyhal::instruction - Rust

Module polyhal::instruction

source ·

Structs

\ No newline at end of file diff --git a/polyhal/instruction/sidebar-items.js b/polyhal/instruction/sidebar-items.js new file mode 100644 index 0000000..11e2ee0 --- /dev/null +++ b/polyhal/instruction/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Instruction"]}; \ No newline at end of file diff --git a/polyhal/instruction/struct.Instruction.html b/polyhal/instruction/struct.Instruction.html new file mode 100644 index 0000000..2aa9cff --- /dev/null +++ b/polyhal/instruction/struct.Instruction.html @@ -0,0 +1,13 @@ +Instruction in polyhal::instruction - Rust
pub struct Instruction;
Expand description

Platform Instruction +Instruction::ebreak Intruction Breakpoint

+

Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/irq/index.html b/polyhal/irq/index.html new file mode 100644 index 0000000..57fae1d --- /dev/null +++ b/polyhal/irq/index.html @@ -0,0 +1 @@ +polyhal::irq - Rust

Module polyhal::irq

source ·

Structs

  • IRQ interface for exposing.
\ No newline at end of file diff --git a/polyhal/irq/sidebar-items.js b/polyhal/irq/sidebar-items.js new file mode 100644 index 0000000..804e441 --- /dev/null +++ b/polyhal/irq/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["IRQ"]}; \ No newline at end of file diff --git a/polyhal/irq/struct.IRQ.html b/polyhal/irq/struct.IRQ.html new file mode 100644 index 0000000..116e149 --- /dev/null +++ b/polyhal/irq/struct.IRQ.html @@ -0,0 +1,28 @@ +IRQ in polyhal::irq - Rust

Struct polyhal::irq::IRQ

source ·
pub struct IRQ;
Expand description

IRQ interface for exposing.

+

TODO: Implement this interface.

+

How to use this interface.

+ +
// Init irq
+IRQ::init();
+
+// Enable irq 3
+IRQ::enable(3);
+
+// Disable irq 3
+IRQ::disable(3);
+
+// Check if irq is enabled
+// Return true if the irq is enabled.
+IRQ::enabled(3);
+
+

Auto Trait Implementations§

§

impl RefUnwindSafe for IRQ

§

impl Send for IRQ

§

impl Sync for IRQ

§

impl Unpin for IRQ

§

impl UnwindSafe for IRQ

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/mem/index.html b/polyhal/mem/index.html new file mode 100644 index 0000000..0ee5cb4 --- /dev/null +++ b/polyhal/mem/index.html @@ -0,0 +1 @@ +polyhal::mem - Rust

Module polyhal::mem

source ·

Structs

\ No newline at end of file diff --git a/polyhal/mem/sidebar-items.js b/polyhal/mem/sidebar-items.js new file mode 100644 index 0000000..39051f8 --- /dev/null +++ b/polyhal/mem/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Barrier"]}; \ No newline at end of file diff --git a/polyhal/mem/struct.Barrier.html b/polyhal/mem/struct.Barrier.html new file mode 100644 index 0000000..fa5a968 --- /dev/null +++ b/polyhal/mem/struct.Barrier.html @@ -0,0 +1,15 @@ +Barrier in polyhal::mem - Rust

Struct polyhal::mem::Barrier

source ·
pub struct Barrier;
Expand description

This is a barrier function.

+

This struct has two functions. +Barrier::complete_sync: ensures the correct sequencing of instructions +Barrier::ordering_sync: ensures the visibility and consistency of memory operations

+

Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/multicore/index.html b/polyhal/multicore/index.html new file mode 100644 index 0000000..6a6057e --- /dev/null +++ b/polyhal/multicore/index.html @@ -0,0 +1 @@ +polyhal::multicore - Rust

Module polyhal::multicore

source ·

Structs

  • This is a leader for the multicore operation
\ No newline at end of file diff --git a/polyhal/multicore/sidebar-items.js b/polyhal/multicore/sidebar-items.js new file mode 100644 index 0000000..36aeb8e --- /dev/null +++ b/polyhal/multicore/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["MultiCore"]}; \ No newline at end of file diff --git a/polyhal/multicore/struct.MultiCore.html b/polyhal/multicore/struct.MultiCore.html new file mode 100644 index 0000000..8058b13 --- /dev/null +++ b/polyhal/multicore/struct.MultiCore.html @@ -0,0 +1,21 @@ +MultiCore in polyhal::multicore - Rust
pub struct MultiCore;
Expand description

This is a leader for the multicore operation

+

You can use this function to use the multicore operation

+

Boot other calls after the multicore +If you use this function call, you should call it after arch::init(..); +This function will allocate the stack and map it for itself.

+ +
Multicore::boot_all();
+

Here will have more functionality about multicore in the future.

+

Implementations§

source§

impl MultiCore

Implement the function for multicore

+
source

pub fn boot_all()

Boot all application cores.

+

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/once/index.html b/polyhal/once/index.html new file mode 100644 index 0000000..f11f5d9 --- /dev/null +++ b/polyhal/once/index.html @@ -0,0 +1 @@ +polyhal::once - Rust

Module polyhal::once

source ·

Structs

\ No newline at end of file diff --git a/polyhal/once/sidebar-items.js b/polyhal/once/sidebar-items.js new file mode 100644 index 0000000..2393cbf --- /dev/null +++ b/polyhal/once/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["LazyInit"]}; \ No newline at end of file diff --git a/polyhal/once/struct.LazyInit.html b/polyhal/once/struct.LazyInit.html new file mode 100644 index 0000000..1cac906 --- /dev/null +++ b/polyhal/once/struct.LazyInit.html @@ -0,0 +1,17 @@ +LazyInit in polyhal::once - Rust

Struct polyhal::once::LazyInit

source ·
pub struct LazyInit<T> { /* private fields */ }

Implementations§

source§

impl<T> LazyInit<T>

source

pub const fn new() -> Self

source

pub fn init_by(&self, data: T)

source

pub fn is_init(&self) -> bool

source

pub fn try_get(&self) -> Option<&T>

source

pub unsafe fn get_unchecked(&self) -> &T

Safety
+

Must be called after initialization.

+
source

pub unsafe fn get_mut_unchecked(&mut self) -> &mut T

Safety
+

Must be called after initialization.

+

Trait Implementations§

source§

impl<T: Debug> Debug for LazyInit<T>

source§

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

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

impl<T> Deref for LazyInit<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<T> DerefMut for LazyInit<T>

source§

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

Mutably dereferences the value.
source§

impl<T> Drop for LazyInit<T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<T: Send> Send for LazyInit<T>

source§

impl<T: Send + Sync> Sync for LazyInit<T>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for LazyInit<T>

§

impl<T> Unpin for LazyInit<T>where + T: Unpin,

§

impl<T> UnwindSafe for LazyInit<T>where + T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/pagetable/enum.MappingSize.html b/polyhal/pagetable/enum.MappingSize.html new file mode 100644 index 0000000..8b8425a --- /dev/null +++ b/polyhal/pagetable/enum.MappingSize.html @@ -0,0 +1,16 @@ +MappingSize in polyhal::pagetable - Rust
pub enum MappingSize {
+    Page4KB,
+}
Expand description

This structure indicates size of the page that will be mapped.

+

TODO: Support More Page Size, 16KB or 32KB +Just support 4KB right now.

+

Variants§

§

Page4KB

Trait Implementations§

source§

impl Debug for MappingSize

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/pagetable/index.html b/polyhal/pagetable/index.html new file mode 100644 index 0000000..742b9bb --- /dev/null +++ b/polyhal/pagetable/index.html @@ -0,0 +1,3 @@ +polyhal::pagetable - Rust

Module polyhal::pagetable

source ·

Structs

Enums

  • This structure indicates size of the page that will be mapped.
\ No newline at end of file diff --git a/polyhal/pagetable/sidebar-items.js b/polyhal/pagetable/sidebar-items.js new file mode 100644 index 0000000..39ce394 --- /dev/null +++ b/polyhal/pagetable/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"enum":["MappingSize"],"struct":["MappingFlags","PageTable","PageTableWrapper","TLB"]}; \ No newline at end of file diff --git a/polyhal/pagetable/struct.MappingFlags.html b/polyhal/pagetable/struct.MappingFlags.html new file mode 100644 index 0000000..c756c78 --- /dev/null +++ b/polyhal/pagetable/struct.MappingFlags.html @@ -0,0 +1,91 @@ +MappingFlags in polyhal::pagetable - Rust
pub struct MappingFlags(/* private fields */);
Expand description

Mapping flags for page table.

+

Implementations§

source§

impl MappingFlags

source

pub const P: Self = _

Persent

+
source

pub const U: Self = _

User Accessable Flag

+
source

pub const R: Self = _

Readable Flag

+
source

pub const W: Self = _

Writeable Flag

+
source

pub const X: Self = _

Executeable Flag

+
source

pub const A: Self = _

Accessed Flag

+
source

pub const D: Self = _

Dirty Flag, indicating that the page was written

+
source

pub const G: Self = _

Global Flag

+
source

pub const Device: Self = _

Device Flag, indicating that the page was used for device memory

+
source

pub const Cache: Self = _

Cache Flag, indicating that the page will be cached

+
source

pub const RWX: Self = _

Read | Write | Executeable Flags

+
source

pub const URW: Self = _

User | Read | Write Flags

+
source

pub const URX: Self = _

User | Read | Executeable Flags

+
source

pub const URWX: Self = _

User | Read | Write | Executeable Flags

+
source§

impl MappingFlags

source

pub const fn empty() -> Self

Get a flags value with all bits unset.

+
source

pub const fn all() -> Self

Get a flags value with all known bits set.

+
source

pub const fn bits(&self) -> u64

Get the underlying bits value.

+

The returned value is exactly the bits set in this flags value.

+
source

pub const fn from_bits(bits: u64) -> Option<Self>

Convert from a bits value.

+

This method will return None if any unknown bits are set.

+
source

pub const fn from_bits_truncate(bits: u64) -> Self

Convert from a bits value, unsetting any unknown bits.

+
source

pub const fn from_bits_retain(bits: u64) -> Self

Convert from a bits value exactly.

+
source

pub fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set.

+

This method will return None if name is empty or doesn’t +correspond to any named flag.

+
source

pub const fn is_empty(&self) -> bool

Whether all bits in this flags value are unset.

+
source

pub const fn is_all(&self) -> bool

Whether all known bits in this flags value are set.

+
source

pub const fn intersects(&self, other: Self) -> bool

Whether any set bits in a source flags value are also set in a target flags value.

+
source

pub const fn contains(&self, other: Self) -> bool

Whether all set bits in a source flags value are also set in a target flags value.

+
source

pub fn insert(&mut self, other: Self)

The bitwise or (|) of the bits in two flags values.

+
source

pub fn remove(&mut self, other: Self)

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +remove won’t truncate other, but the ! operator will.

+
source

pub fn toggle(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in two flags values.

+
source

pub fn set(&mut self, other: Self, value: bool)

Call insert when value is true or remove when value is false.

+
source

pub const fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in two flags values.

+
source

pub const fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in two flags values.

+
source

pub const fn difference(self, other: Self) -> Self

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +difference won’t truncate other, but the ! operator will.

+
source

pub const fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in two flags values.

+
source

pub const fn complement(self) -> Self

The bitwise negation (!) of the bits in a flags value, truncating the result.

+
source§

impl MappingFlags

source

pub const fn iter(&self) -> Iter<MappingFlags>

Yield a set of contained flags values.

+

Each yielded flags value will correspond to a defined named flag. Any unknown bits +will be yielded together as a final flags value.

+
source

pub const fn iter_names(&self) -> IterNames<MappingFlags>

Yield a set of contained named flags values.

+

This method is like iter, except only yields bits in contained named flags. +Any unknown bits, or bits not corresponding to a contained flag will not be yielded.

+

Trait Implementations§

source§

impl Binary for MappingFlags

source§

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

Formats the value using the given formatter.
source§

impl BitAnd for MappingFlags

source§

fn bitand(self, other: Self) -> Self

The bitwise and (&) of the bits in two flags values.

+
§

type Output = MappingFlags

The resulting type after applying the & operator.
source§

impl BitAndAssign for MappingFlags

source§

fn bitand_assign(&mut self, other: Self)

The bitwise and (&) of the bits in two flags values.

+
source§

impl BitOr for MappingFlags

source§

fn bitor(self, other: MappingFlags) -> Self

The bitwise or (|) of the bits in two flags values.

+
§

type Output = MappingFlags

The resulting type after applying the | operator.
source§

impl BitOrAssign for MappingFlags

source§

fn bitor_assign(&mut self, other: Self)

The bitwise or (|) of the bits in two flags values.

+
source§

impl BitXor for MappingFlags

source§

fn bitxor(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in two flags values.

+
§

type Output = MappingFlags

The resulting type after applying the ^ operator.
source§

impl BitXorAssign for MappingFlags

source§

fn bitxor_assign(&mut self, other: Self)

The bitwise exclusive-or (^) of the bits in two flags values.

+
source§

impl Clone for MappingFlags

source§

fn clone(&self) -> MappingFlags

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 Debug for MappingFlags

source§

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

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

impl Extend<MappingFlags> for MappingFlags

source§

fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)

The bitwise or (|) of the bits in each flags value.

+
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Flags for MappingFlags

source§

const FLAGS: &'static [Flag<MappingFlags>] = _

The set of defined flags.
§

type Bits = u64

The underlying bits type.
source§

fn bits(&self) -> u64

Get the underlying bits value. Read more
source§

fn from_bits_retain(bits: u64) -> MappingFlags

Convert from a bits value exactly.
§

fn empty() -> Self

Get a flags value with all bits unset.
§

fn all() -> Self

Get a flags value with all known bits set.
§

fn from_bits(bits: Self::Bits) -> Option<Self>

Convert from a bits value. Read more
§

fn from_bits_truncate(bits: Self::Bits) -> Self

Convert from a bits value, unsetting any unknown bits.
§

fn from_name(name: &str) -> Option<Self>

Get a flags value with the bits of a flag with the given name set. Read more
§

fn iter(&self) -> Iter<Self>

Yield a set of contained flags values. Read more
§

fn iter_names(&self) -> IterNames<Self>

Yield a set of contained named flags values. Read more
§

fn is_empty(&self) -> bool

Whether all bits in this flags value are unset.
§

fn is_all(&self) -> bool

Whether all known bits in this flags value are set.
§

fn intersects(&self, other: Self) -> boolwhere + Self: Sized,

Whether any set bits in a source flags value are also set in a target flags value.
§

fn contains(&self, other: Self) -> boolwhere + Self: Sized,

Whether all set bits in a source flags value are also set in a target flags value.
§

fn insert(&mut self, other: Self)where + Self: Sized,

The bitwise or (|) of the bits in two flags values.
§

fn remove(&mut self, other: Self)where + Self: Sized,

The intersection of a source flags value with the complement of a target flags value (&!). Read more
§

fn toggle(&mut self, other: Self)where + Self: Sized,

The bitwise exclusive-or (^) of the bits in two flags values.
§

fn set(&mut self, other: Self, value: bool)where + Self: Sized,

Call [Flags::insert] when value is true or [Flags::remove] when value is false.
§

fn intersection(self, other: Self) -> Self

The bitwise and (&) of the bits in two flags values.
§

fn union(self, other: Self) -> Self

The bitwise or (|) of the bits in two flags values.
§

fn difference(self, other: Self) -> Self

The intersection of a source flags value with the complement of a target flags value (&!). Read more
§

fn symmetric_difference(self, other: Self) -> Self

The bitwise exclusive-or (^) of the bits in two flags values.
§

fn complement(self) -> Self

The bitwise negation (!) of the bits in a flags value, truncating the result.
source§

impl FromIterator<MappingFlags> for MappingFlags

source§

fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self

The bitwise or (|) of the bits in each flags value.

+
source§

impl Hash for MappingFlags

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where + H: Hasher, + Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl IntoIterator for MappingFlags

§

type Item = MappingFlags

The type of the elements being iterated over.
§

type IntoIter = Iter<MappingFlags>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl LowerHex for MappingFlags

source§

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

Formats the value using the given formatter.
source§

impl Not for MappingFlags

source§

fn not(self) -> Self

The bitwise negation (!) of the bits in a flags value, truncating the result.

+
§

type Output = MappingFlags

The resulting type after applying the ! operator.
source§

impl Octal for MappingFlags

source§

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

Formats the value using the given formatter.
source§

impl Ord for MappingFlags

source§

fn cmp(&self, other: &MappingFlags) -> Ordering

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

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

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

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

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

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

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

impl PartialEq for MappingFlags

source§

fn eq(&self, other: &MappingFlags) -> 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 PartialOrd for MappingFlags

source§

fn partial_cmp(&self, other: &MappingFlags) -> 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 PublicFlags for MappingFlags

§

type Primitive = u64

The type of the underlying storage.
§

type Internal = InternalBitFlags

The type of the internal field on the generated flags type.
source§

impl Sub for MappingFlags

source§

fn sub(self, other: Self) -> Self

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +difference won’t truncate other, but the ! operator will.

+
§

type Output = MappingFlags

The resulting type after applying the - operator.
source§

impl SubAssign for MappingFlags

source§

fn sub_assign(&mut self, other: Self)

The intersection of a source flags value with the complement of a target flags value (&!).

+

This method is not equivalent to self & !other when other has unknown bits set. +difference won’t truncate other, but the ! operator will.

+
source§

impl UpperHex for MappingFlags

source§

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

Formats the value using the given formatter.
source§

impl Copy for MappingFlags

source§

impl Eq for MappingFlags

source§

impl StructuralEq for MappingFlags

source§

impl StructuralPartialEq for MappingFlags

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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 Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/pagetable/struct.PageTable.html b/polyhal/pagetable/struct.PageTable.html new file mode 100644 index 0000000..778db70 --- /dev/null +++ b/polyhal/pagetable/struct.PageTable.html @@ -0,0 +1,57 @@ +PageTable in polyhal::pagetable - Rust
#[repr(C)]
pub struct PageTable(/* private fields */);
Expand description

Page Table

+

This is just the page table defination. +The implementation of the page table in the specific architecture mod. +Such as: +x86_64/page_table.rs +riscv64/page_table/sv39.rs +aarch64/page_table.rs +loongarch64/page_table.rs

+

Implementations§

source§

impl PageTable

source

pub fn map_page( + &self, + vpn: VirtPage, + ppn: PhysPage, + flags: MappingFlags, + _size: MappingSize +)

Mapping a page to specific virtual page (user space address).

+

Ensure that PageTable is which you want to map. +vpn: Virtual page will be mapped. +ppn: Physical page. +flags: Mapping flags, include Read, Write, Execute and so on. +size: MappingSize. Just support 4KB page currently.

+
source

pub fn map_kernel( + &self, + vpn: VirtPage, + ppn: PhysPage, + flags: MappingFlags, + _size: MappingSize +)

Mapping a page to specific address(kernel space address).

+

TODO: This method is not implemented. +TIPS: If we mapped to kernel, the page will be shared between different pagetable.

+

Ensure that PageTable is which you want to map. +vpn: Virtual page will be mapped. +ppn: Physical page. +flags: Mapping flags, include Read, Write, Execute and so on. +size: MappingSize. Just support 4KB page currently.

+

How to implement shared.

+
source

pub fn unmap_page(&self, vpn: VirtPage)

Unmap a page from specific virtual page (user space address).

+

Ensure the virtual page is exists. +vpn: Virtual address.

+
source

pub fn translate(&self, vaddr: VirtAddr) -> Option<(PhysAddr, MappingFlags)>

Translate a virtual adress to a physical address and mapping flags.

+

Return None if the vaddr isn’t mapped. +vpn: The virtual address will be translated.

+
source

pub fn release(&self)

Release the page table entry.

+

The page table entry in the user space address will be released. +Page Table Wikipedia. +You don’t need to care about this if you just want to use.

+
source§

impl PageTable

source

pub fn current() -> Self

source

pub fn kernel_pte_entry(&self) -> PhysAddr

source

pub fn restore(&self)

source

pub fn change(&self)

Trait Implementations§

source§

impl Clone for PageTable

source§

fn clone(&self) -> PageTable

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 Debug for PageTable

source§

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

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

impl Copy for PageTable

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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 Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/pagetable/struct.PageTableWrapper.html b/polyhal/pagetable/struct.PageTableWrapper.html new file mode 100644 index 0000000..733844d --- /dev/null +++ b/polyhal/pagetable/struct.PageTableWrapper.html @@ -0,0 +1,59 @@ +PageTableWrapper in polyhal::pagetable - Rust
pub struct PageTableWrapper(pub PageTable);
Expand description

Page Table Wrapper

+

You can use this wrapper to packing PageTable. +If you release the PageTableWrapper, +the PageTable will release its page table entry.

+

Tuple Fields§

§0: PageTable

Implementations§

source§

impl PageTableWrapper

Allocate a new PageTableWrapper with new page table root

+

This operation will restore the page table.

+
source

pub fn alloc() -> Self

Alloc a new PageTableWrapper with new page table root +This operation will copy kernel page table space from booting page table.

+

Methods from Deref<Target = PageTable>§

source

pub fn map_page( + &self, + vpn: VirtPage, + ppn: PhysPage, + flags: MappingFlags, + _size: MappingSize +)

Mapping a page to specific virtual page (user space address).

+

Ensure that PageTable is which you want to map. +vpn: Virtual page will be mapped. +ppn: Physical page. +flags: Mapping flags, include Read, Write, Execute and so on. +size: MappingSize. Just support 4KB page currently.

+
source

pub fn map_kernel( + &self, + vpn: VirtPage, + ppn: PhysPage, + flags: MappingFlags, + _size: MappingSize +)

Mapping a page to specific address(kernel space address).

+

TODO: This method is not implemented. +TIPS: If we mapped to kernel, the page will be shared between different pagetable.

+

Ensure that PageTable is which you want to map. +vpn: Virtual page will be mapped. +ppn: Physical page. +flags: Mapping flags, include Read, Write, Execute and so on. +size: MappingSize. Just support 4KB page currently.

+

How to implement shared.

+
source

pub fn unmap_page(&self, vpn: VirtPage)

Unmap a page from specific virtual page (user space address).

+

Ensure the virtual page is exists. +vpn: Virtual address.

+
source

pub fn translate(&self, vaddr: VirtAddr) -> Option<(PhysAddr, MappingFlags)>

Translate a virtual adress to a physical address and mapping flags.

+

Return None if the vaddr isn’t mapped. +vpn: The virtual address will be translated.

+
source

pub fn release(&self)

Release the page table entry.

+

The page table entry in the user space address will be released. +Page Table Wikipedia. +You don’t need to care about this if you just want to use.

+
source

pub fn kernel_pte_entry(&self) -> PhysAddr

source

pub fn restore(&self)

source

pub fn change(&self)

Trait Implementations§

source§

impl Debug for PageTableWrapper

source§

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

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

impl Deref for PageTableWrapper

§

type Target = PageTable

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl Drop for PageTableWrapper

Page Table Release.

+

You must implement this trait to release page table. +Include the page table entry and root page.

+
source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/pagetable/struct.TLB.html b/polyhal/pagetable/struct.TLB.html new file mode 100644 index 0000000..5a5a25d --- /dev/null +++ b/polyhal/pagetable/struct.TLB.html @@ -0,0 +1,27 @@ +TLB in polyhal::pagetable - Rust

Struct polyhal::pagetable::TLB

source ·
pub struct TLB;
Expand description

TLB Operation set. +Such as flush_vaddr, flush_all. +Just use it in the fn.

+

there are some methods in the TLB implementation

+

Flush the tlb entry through the specific virtual address

+
TLB::flush_vaddr(arg0);  arg0 should be VirtAddr
+

Flush all tlb entries

+
TLB::flush_all();
+

Implementations§

source§

impl TLB

TLB operations

+
source

pub fn flush_vaddr(vaddr: VirtAddr)

flush the TLB entry by VirtualAddress +just use it directly

+

TLB::flush_vaddr(arg0); // arg0 is the virtual address(VirtAddr)

+
source

pub fn flush_all()

flush all tlb entry

+

how to use ? +just +TLB::flush_all();

+

Auto Trait Implementations§

§

impl RefUnwindSafe for TLB

§

impl Send for TLB

§

impl Sync for TLB

§

impl Unpin for TLB

§

impl UnwindSafe for TLB

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/sidebar-items.js b/polyhal/sidebar-items.js new file mode 100644 index 0000000..fbbf6f0 --- /dev/null +++ b/polyhal/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"attr":["arch_entry","arch_interrupt"],"constant":["MULTI_CORE_AREA","MULTI_CORE_AREA_SIZE","PAGE_SIZE","SIG_RETURN_ADDR","USER_VADDR_END","VIRT_ADDR_START"],"enum":["KContextArgs","TrapFrameArgs","TrapType"],"fn":["arch_init","context_switch","context_switch_pt","disable_irq","enable_external_irq","enable_irq","get_cpu_num","get_fdt","get_mem_areas","hart_id","init","kernel_page_table","read_current_tp","run_user_task","run_user_task_forever","shutdown","switch_to_kernel_page_table","wfi"],"mod":["addr","api","consts","debug","instruction","irq","mem","multicore","once","pagetable","time"],"struct":["KContext","TrapFrame"],"trait":["PageAlloc"]}; \ No newline at end of file diff --git a/polyhal/struct.KContext.html b/polyhal/struct.KContext.html new file mode 100644 index 0000000..193b4a0 --- /dev/null +++ b/polyhal/struct.KContext.html @@ -0,0 +1,35 @@ +KContext in polyhal - Rust

Struct polyhal::KContext

source ·
#[repr(C)]
pub struct KContext { /* private fields */ }
Expand description

Kernel Context

+

Kernel Context is used to switch context between kernel task.

+

Implementations§

source§

impl KContext

source

pub fn blank() -> Self

Create a new blank Kernel Context.

+

Trait Implementations§

source§

impl Debug for KContext

source§

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

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

impl Index<KContextArgs> for KContext

Indexing operations for KContext

+

Using it just like the Vector.

+

#[derive(Debug)] +pub enum KContextArgs { +/// Kernel Stack Pointer +KSP, +/// Kernel Thread Pointer +KTP, +/// Kernel Program Counter +KPC +}

+

etc. Get reg of the kernel stack:

+

let ksp = KContextKContextArgs::KSP +let kpc = KContextKContextArgs::KPC +let ktp = KContextKContextArgs::KTP

+
§

type Output = usize

The returned type after indexing.
source§

fn index(&self, index: KContextArgs) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<KContextArgs> for KContext

Indexing Mutable operations for KContext

+

Using it just like the Vector.

+

etc. Change the value of the kernel Context using IndexMut

+

KContextKContextArgs::KSP = ksp; +KContextKContextArgs::KPC = kpc; +KContextKContextArgs::KTP = ktp;

+
source§

fn index_mut(&mut self, index: KContextArgs) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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, U> TryFrom<U> for Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/struct.TrapFrame.html b/polyhal/struct.TrapFrame.html new file mode 100644 index 0000000..b486c83 --- /dev/null +++ b/polyhal/struct.TrapFrame.html @@ -0,0 +1,17 @@ +TrapFrame in polyhal - Rust

Struct polyhal::TrapFrame

source ·
#[repr(C)]
pub struct TrapFrame { + pub x: [usize; 32], + pub sstatus: Sstatus, + pub sepc: usize, + pub fsx: [usize; 2], +}

Fields§

§x: [usize; 32]§sstatus: Sstatus§sepc: usize§fsx: [usize; 2]

Implementations§

source§

impl TrapFrame

source

pub fn new() -> Self

source

pub fn args(&self) -> [usize; 6]

source

pub fn syscall_ok(&mut self)

Trait Implementations§

source§

impl Clone for TrapFrame

source§

fn clone(&self) -> TrapFrame

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 Debug for TrapFrame

source§

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

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

impl Index<TrapFrameArgs> for TrapFrame

§

type Output = usize

The returned type after indexing.
source§

fn index(&self, index: TrapFrameArgs) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<TrapFrameArgs> for TrapFrame

source§

fn index_mut(&mut self, index: TrapFrameArgs) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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 Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/time/index.html b/polyhal/time/index.html new file mode 100644 index 0000000..bacc35a --- /dev/null +++ b/polyhal/time/index.html @@ -0,0 +1 @@ +polyhal::time - Rust

Module polyhal::time

source ·

Structs

  • Time struct and its interface
\ No newline at end of file diff --git a/polyhal/time/sidebar-items.js b/polyhal/time/sidebar-items.js new file mode 100644 index 0000000..523bc91 --- /dev/null +++ b/polyhal/time/sidebar-items.js @@ -0,0 +1 @@ +window.SIDEBAR_ITEMS = {"struct":["Time"]}; \ No newline at end of file diff --git a/polyhal/time/struct.Time.html b/polyhal/time/struct.Time.html new file mode 100644 index 0000000..041e814 --- /dev/null +++ b/polyhal/time/struct.Time.html @@ -0,0 +1,29 @@ +Time in polyhal::time - Rust

Struct polyhal::time::Time

source ·
pub struct Time(/* private fields */);
Expand description

Time struct and its interface

+

You can use this to get time from ticks

+

get current time

+
Time::now();
+

get current cpu’s frequency

+
Time::get_freq();
+

get how many nanoseconds have passed.

+
Time::now().to_nsec();
+

get how many microseconds have passed.

+
Time::now().to_usec();
+

get how many millisecond have passed.

+
Time::now().to_msec();
+

get how may ticks have passed

+
Time::now().raw();
+

convert ticks to time

+
Time::from_raw(Time::now().raw());
+

Implementations§

source§

impl Time

source

pub fn to_msec(&self) -> usize

source

pub fn to_usec(&self) -> usize

source

pub fn to_nsec(&self) -> usize

Converts hardware ticks to nanoseconds.

+
source

pub fn raw(&self) -> usize

source

pub fn from_raw(raw: usize) -> Self

source§

impl Time

source

pub fn get_freq() -> usize

source

pub fn now() -> Self

Trait Implementations§

source§

impl Clone for Time

source§

fn clone(&self) -> Time

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 Debug for Time

source§

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

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

impl Copy for Time

Auto Trait Implementations§

§

impl RefUnwindSafe for Time

§

impl Send for Time

§

impl Sync for Time

§

impl Unpin for Time

§

impl UnwindSafe for Time

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere + T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere + T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

+
source§

impl<T, U> Into<U> for Twhere + 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 Twhere + 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 Twhere + 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 Twhere + 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.
\ No newline at end of file diff --git a/polyhal/trait.PageAlloc.html b/polyhal/trait.PageAlloc.html new file mode 100644 index 0000000..f806022 --- /dev/null +++ b/polyhal/trait.PageAlloc.html @@ -0,0 +1,5 @@ +PageAlloc in polyhal - Rust

Trait polyhal::PageAlloc

source ·
pub trait PageAlloc: Sync {
+    // Required methods
+    fn alloc(&self) -> PhysPage;
+    fn dealloc(&self, ppn: PhysPage);
+}

Required Methods§

source

fn alloc(&self) -> PhysPage

source

fn dealloc(&self, ppn: PhysPage)

Implementors§

\ No newline at end of file diff --git a/search-index.js b/search-index.js new file mode 100644 index 0000000..3a673ba --- /dev/null +++ b/search-index.js @@ -0,0 +1,5 @@ +var searchIndex = JSON.parse('{\ +"polyhal":{"doc":"This is a crate to help you supporting multiple platforms.","t":"PPPPPPFGPPPPSSSKPPPSPPPPPPFGGSPPSCMCXHXNNNNNNNNNNNNNNNNCHHMCHHHNNNNNNNNNNOHHHHNNNNHCNNNNNCHCCNCCEHHHOHOHNCNNNNNNNNNNNNNNNNNHOFFFFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNSSFNNNNNNNNNNFNNNNNNNNFNNNNNNNFNNNNNNNNNFNNNNNNNNFNNNNNNNNNNNNNNNNNTTTTTFGTPFFTTFTTTTTTNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNFNNNNNNNNNNNNNNNNNN","n":["ARG0","ARG1","ARG2","Breakpoint","IllegalInstruction","InstructionPageFault","KContext","KContextArgs","KPC","KSP","KTP","LoadPageFault","MULTI_CORE_AREA","MULTI_CORE_AREA_SIZE","PAGE_SIZE","PageAlloc","RA","RET","SEPC","SIG_RETURN_ADDR","SP","SYSCALL","StorePageFault","SupervisorExternal","TLS","Time","TrapFrame","TrapFrameArgs","TrapType","USER_VADDR_END","Unknown","UserEnvCall","VIRT_ADDR_START","addr","alloc","api","arch_entry","arch_init","arch_interrupt","args","blank","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","clone","clone","clone_into","clone_into","consts","context_switch","context_switch_pt","dealloc","debug","disable_irq","enable_external_irq","enable_irq","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","fsx","get_cpu_num","get_fdt","get_mem_areas","hart_id","index","index","index_mut","index_mut","init","instruction","into","into","into","into","into","irq","kernel_page_table","mem","multicore","new","once","pagetable","percpu","read_current_tp","run_user_task","run_user_task_forever","sepc","shutdown","sstatus","switch_to_kernel_page_table","syscall_ok","time","to_owned","to_owned","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","wfi","x","PhysAddr","PhysPage","VirtAddr","VirtPage","add","add","add","addr","addr","as_num","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","ceil","clone","clone","clone","clone","clone_into","clone_into","clone_into","clone_into","cmp","cmp","cmp","cmp","copy_value_from_another","drop_clear","eq","eq","eq","eq","floor","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from","from","from","from","from","from","from_addr","from_addr","get_buffer","get_cstr","get_cstr","get_mut_ptr","get_mut_ptr","get_mut_ref","get_ptr","get_ptr","get_ref","into","into","into","into","new","new","new","new","partial_cmp","partial_cmp","partial_cmp","partial_cmp","pn_index","pn_offest","slice_mut_with_len","slice_mut_with_len","slice_until","slice_with_len","slice_with_len","to_addr","to_addr","to_owned","to_owned","to_owned","to_owned","to_string","to_string","to_string","to_string","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","STACK_SIZE","TRAPFRAME_SIZE","DebugConsole","borrow","borrow_mut","from","getchar","into","putchar","try_from","try_into","type_id","write_str","Instruction","borrow","borrow_mut","ebreak","from","into","try_from","try_into","type_id","IRQ","borrow","borrow_mut","from","into","try_from","try_into","type_id","Barrier","borrow","borrow_mut","complete_sync","from","into","ordering_sync","try_from","try_into","type_id","MultiCore","boot_all","borrow","borrow_mut","from","into","try_from","try_into","type_id","LazyInit","borrow","borrow_mut","deref","deref_mut","drop","fmt","from","get_mut_unchecked","get_unchecked","init_by","into","is_init","new","try_from","try_get","try_into","type_id","A","Cache","D","Device","G","MappingFlags","MappingSize","P","Page4KB","PageTable","PageTableWrapper","R","RWX","TLB","U","URW","URWX","URX","W","X","all","alloc","bitand","bitand_assign","bitor","bitor_assign","bits","bits","bitxor","bitxor_assign","borrow","borrow","borrow","borrow","borrow","borrow_mut","borrow_mut","borrow_mut","borrow_mut","borrow_mut","change","clone","clone","clone_into","clone_into","cmp","complement","contains","current","deref","difference","drop","empty","eq","extend","flush_all","flush_vaddr","fmt","fmt","fmt","fmt","fmt","fmt","fmt","fmt","from","from","from","from","from","from_bits","from_bits_retain","from_bits_retain","from_bits_truncate","from_iter","from_name","hash","insert","intersection","intersects","into","into","into","into","into","into_iter","is_all","is_empty","iter","iter_names","kernel_pte_entry","map_kernel","map_page","not","partial_cmp","release","remove","restore","set","sub","sub_assign","symmetric_difference","to_owned","to_owned","toggle","translate","try_from","try_from","try_from","try_from","try_from","try_into","try_into","try_into","try_into","try_into","type_id","type_id","type_id","type_id","type_id","union","unmap_page","Time","borrow","borrow_mut","clone","clone_into","fmt","from","from_raw","get_freq","into","now","raw","to_msec","to_nsec","to_owned","to_usec","try_from","try_into","type_id"],"q":[[0,"polyhal"],[125,"polyhal::addr"],[234,"polyhal::consts"],[236,"polyhal::debug"],[247,"polyhal::instruction"],[256,"polyhal::irq"],[264,"polyhal::mem"],[274,"polyhal::multicore"],[283,"polyhal::once"],[301,"polyhal::pagetable"],[424,"polyhal::time"],[443,"core::fmt"],[444,"core::fmt"],[445,"core::option"],[446,"alloc::vec"],[447,"core::result"],[448,"core::any"],[449,"core::cmp"],[450,"core::ffi::c_str"],[451,"alloc::string"],[452,"core::fmt"],[453,"core::hash"],[454,"bitflags::iter"],[455,"bitflags::iter"]],"d":["","","","","","","Kernel Context","Kernel Context Arg Type.","Kernel Program Counter","Kernel Stack Pointer","Kernel Thread Pointer","","Every core has a unique area of memory. Just using …","","","","","","","","","","","","","","","Trap Frame Arg Type","","","","","","","","","","","","","Create a new blank Kernel Context.","","","","","","","","","","","","","","","","Context Switch","Context Switch With Page Table","","","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","","Get the number of cpus","Get the fdt","Get the memory area, this function should be called after …","","","","","","Init arch with page allocator, like log crate Please …","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","","Return Some(()) if it was interrupt by syscall, otherwise …","","","调用 SBI_SHUTDOWN 来关闭操作系统(直接退出 …","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Returns the argument unchanged.","","","Returns the argument unchanged.","Returns the argument unchanged.","","","Returns the argument unchanged.","","","","","","","","","","","","","","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","","","","","","","","Get n level page table index of the given virtual address","Get n level page table offset of the given virtual address","","","","","","","","","","","","","","","","","","","","","","","","","","","","Boot Stack Size. TODO: reduce the boot stack size. Map …","The size of the trap frame(diffent in each architecture.).","This is a console for debugging, If you want to use this …","","","Returns the argument unchanged.","","Calls U::from(self).","","","","","","Platform Instruction Instruction::ebreak Intruction …","","","","Returns the argument unchanged.","Calls U::from(self).","","","","IRQ interface for exposing.","","","Returns the argument unchanged.","Calls U::from(self).","","","","This is a barrier function.","","","","Returns the argument unchanged.","Calls U::from(self).","","","","","This is a leader for the multicore operation","Boot all application cores.","","","Returns the argument unchanged.","Calls U::from(self).","","","","","","","","","","","Returns the argument unchanged.","Safety","Safety","","Calls U::from(self).","","","","","","","Accessed Flag","Cache Flag, indicating that the page will be cached","Dirty Flag, indicating that the page was written","Device Flag, indicating that the page was used for device …","Global Flag","Mapping flags for page table.","This structure indicates size of the page that will be …","Persent","","Page Table","Page Table Wrapper","Readable Flag","Read | Write | Executeable Flags","TLB Operation set. Such as flush_vaddr, flush_all. Just …","User Accessable Flag","User | Read | Write Flags","User | Read | Write | Executeable Flags","User | Read | Executeable Flags","Writeable Flag","Executeable Flag","Get a flags value with all known bits set.","Alloc a new PageTableWrapper with new page table root This …","The bitwise and (&) of the bits in two flags values.","The bitwise and (&) of the bits in two flags values.","The bitwise or (|) of the bits in two flags values.","The bitwise or (|) of the bits in two flags values.","Get the underlying bits value.","","The bitwise exclusive-or (^) of the bits in two flags …","The bitwise exclusive-or (^) of the bits in two flags …","","","","","","","","","","","","","","","","","The bitwise negation (!) of the bits in a flags value, …","Whether all set bits in a source flags value are also set …","","","The intersection of a source flags value with the …","","Get a flags value with all bits unset.","","The bitwise or (|) of the bits in each flags value.","flush all tlb entry","flush the TLB entry by VirtualAddress just use it directly","","","","","","","","","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Returns the argument unchanged.","Convert from a bits value.","Convert from a bits value exactly.","","Convert from a bits value, unsetting any unknown bits.","The bitwise or (|) of the bits in each flags value.","Get a flags value with the bits of a flag with the given …","","The bitwise or (|) of the bits in two flags values.","The bitwise and (&) of the bits in two flags values.","Whether any set bits in a source flags value are also set …","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","Calls U::from(self).","","Whether all known bits in this flags value are set.","Whether all bits in this flags value are unset.","Yield a set of contained flags values.","Yield a set of contained named flags values.","","Mapping a page to specific address(kernel space address).","Mapping a page to specific virtual page (user space …","The bitwise negation (!) of the bits in a flags value, …","","Release the page table entry.","The intersection of a source flags value with the …","","Call insert when value is true or remove when value is …","The intersection of a source flags value with the …","The intersection of a source flags value with the …","The bitwise exclusive-or (^) of the bits in two flags …","","","The bitwise exclusive-or (^) of the bits in two flags …","Translate a virtual adress to a physical address and …","","","","","","","","","","","","","","","","The bitwise or (|) of the bits in two flags values.","Unmap a page from specific virtual page (user space …","Time struct and its interface","","","","","","Returns the argument unchanged.","","","Calls U::from(self).","","","","Converts hardware ticks to nanoseconds.","","","","",""],"i":[13,13,13,8,8,8,0,0,12,12,12,8,0,0,0,0,13,13,13,0,13,13,8,8,13,8,0,0,0,0,8,8,0,0,1,0,0,0,0,4,7,4,7,12,13,8,4,7,12,13,8,4,8,4,8,0,0,0,1,0,0,0,0,4,7,12,13,8,4,7,12,13,8,4,0,0,0,0,4,7,4,7,0,0,4,7,12,13,8,0,0,0,0,4,0,0,0,0,0,0,4,0,4,0,4,0,4,8,4,7,12,13,8,4,7,12,13,8,4,7,12,13,8,0,4,0,0,0,0,2,2,20,21,22,2,21,22,2,20,21,22,2,20,22,21,22,2,20,21,22,2,20,21,22,2,20,2,2,21,22,2,20,22,21,21,22,22,2,2,20,20,21,21,22,22,22,2,2,2,20,20,20,2,20,2,21,22,21,22,22,21,22,22,21,22,2,20,21,22,2,20,21,22,2,20,20,22,21,22,22,21,22,2,20,21,22,2,20,21,22,2,20,21,22,2,20,21,22,2,20,21,22,2,20,0,0,0,29,29,29,29,29,29,29,29,29,29,0,43,43,43,43,43,43,43,43,0,44,44,44,44,44,44,44,0,45,45,45,45,45,45,45,45,45,0,46,46,46,46,46,46,46,46,0,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,33,33,33,33,33,0,0,33,38,0,0,33,33,0,33,33,33,33,33,33,33,34,33,33,33,33,33,33,33,33,47,33,38,9,34,47,33,38,9,34,9,33,9,33,9,33,33,33,9,34,33,34,33,33,33,47,47,33,33,33,33,33,38,9,34,47,33,38,9,34,33,33,33,33,33,33,33,33,33,33,47,33,38,9,34,33,33,33,33,33,9,9,9,33,33,9,33,9,33,33,33,33,33,9,33,9,47,33,38,9,34,47,33,38,9,34,47,33,38,9,34,33,9,0,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42],"f":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[1,2],0,0,[[],3],0,[4,[[6,[5]]]],[[],7],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[4,4],[8,8],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],0,[[7,7],3],[[7,7,9],3],[[1,2],3],0,[[],3],[[],3],[[],3],[[4,10],11],[[7,10],11],[[12,10],11],[[13,10],11],[[8,10],11],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],0,[[],5],[[],[[15,[14]]]],[[],[[16,[[3,[5,5]]]]]],[[],5],[[4,13],-1,[]],[[7,12],-1,[]],[[4,13],-1,[]],[[7,12],-1,[]],[1,3],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],0,[[],9],0,0,[[],4],0,0,0,[[],5],[4,[[15,[3]]]],[4,17],0,[[],17],0,[[],3],[4,3],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[[],3],0,0,0,0,0,[[2,2],-1,[]],[[2,5],-1,[]],[[20,5],-1,[]],[21,5],[22,5],[2,5],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[22,22],[21,21],[22,22],[2,2],[20,20],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[21,21],23],[[22,22],23],[[2,2],23],[[20,20],23],[[2,2],3],[2,3],[[21,21],24],[[22,22],24],[[2,2],24],[[20,20],24],[22,22],[[21,10],11],[[21,10],11],[[22,10],11],[[22,10],11],[[2,10],11],[[2,10],11],[[20,10],11],[[20,10],11],[2,21],[-1,-1,[]],[20,22],[5,22],[-1,-1,[]],[-1,-1,[]],[5,2],[21,2],[-1,-1,[]],[22,20],[5,20],[5,2],[5,20],[2,[[26,[25]]]],[21,27],[22,27],[21],[22],[22,-1,[]],[21],[22],[22,-1,[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[5,21],[5,22],[5,2],[5,20],[[21,21],[[15,[23]]]],[[22,22],[[15,[23]]]],[[2,2],[[15,[23]]]],[[20,20],[[15,[23]]]],[[20,5],5],[[22,5],5],[[21,5],[[26,[-1]]],[]],[[22,5],[[26,[-1]]],[]],[22,[[26,[-1]]],[]],[[21,5],[[26,[-1]]],[]],[[22,5],[[26,[-1]]],[]],[2,5],[20,5],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,28,[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],0,0,0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[[],[[15,[25]]]],[-1,-2,[],[]],[25,3],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[[29,30],11],0,[-1,-2,[],[]],[-1,-2,[],[]],[[],3],[-1,-1,[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[[],3],[-1,-1,[]],[-1,-2,[],[]],[[],3],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],0,[[],3],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-1,[]],[-1,-2,[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],0,[-1,-2,[],[]],[-1,-2,[],[]],[[[31,[-1]]],-1,[]],[[[31,[-1]]],-1,[]],[[[31,[-1]]],3,[]],[[[31,[-1]],10],11,32],[-1,-1,[]],[[[31,[-1]]],-1,[]],[[[31,[-1]]],-1,[]],[[[31,[-1]],-1],3,[]],[-1,-2,[],[]],[[[31,[-1]]],24,[]],[[],[[31,[-1]]],[]],[-1,[[18,[-2]]],[],[]],[[[31,[-1]]],[[15,[-1]]],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[[],33],[[],34],[[33,33],33],[[33,33],3],[[33,33],33],[[33,33],3],[33,35],[33,35],[[33,33],33],[[33,33],3],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[9,3],[33,33],[9,9],[[-1,-2],3,[],[]],[[-1,-2],3,[],[]],[[33,33],23],[33,33],[[33,33],24],[[],9],[34,-1,[]],[[33,33],33],[34,3],[[],33],[[33,33],24],[[33,-1],3,[[37,[],[[36,[33]]]]]],[[],3],[22,3],[[33,10],11],[[33,10],11],[[33,10],11],[[33,10],11],[[33,10],11],[[38,10],11],[[9,10],11],[[34,10],11],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[-1,-1,[]],[35,[[15,[33]]]],[35,33],[35,33],[35,33],[-1,33,[[37,[],[[36,[33]]]]]],[30,[[15,[33]]]],[[33,-1],3,39],[[33,33],3],[[33,33],33],[[33,33],24],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[-1,-2,[],[]],[33,-1,[]],[33,24],[33,24],[33,[[40,[33]]]],[33,[[41,[33]]]],[9,21],[[9,20,2,33,38],3],[[9,20,2,33,38],3],[33,33],[[33,33],[[15,[23]]]],[9,3],[[33,33],3],[9,3],[[33,33,24],3],[[33,33],33],[[33,33],3],[[33,33],33],[-1,-2,[],[]],[-1,-2,[],[]],[[33,33],3],[[9,22],[[15,[[3,[21,33]]]]]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[-1,19,[]],[[33,33],33],[[9,20],3],0,[-1,-2,[],[]],[-1,-2,[],[]],[42,42],[[-1,-2],3,[],[]],[[42,10],11],[-1,-1,[]],[5,42],[[],5],[-1,-2,[],[]],[[],42],[42,5],[42,5],[42,5],[-1,-2,[],[]],[42,5],[-1,[[18,[-2]]],[],[]],[-1,[[18,[-2]]],[],[]],[-1,19,[]]],"c":[],"p":[[10,"PageAlloc",0],[5,"PhysPage",125],[1,"tuple"],[5,"TrapFrame",0],[1,"usize"],[1,"array"],[5,"KContext",0],[6,"TrapType",0],[5,"PageTable",301],[5,"Formatter",443],[8,"Result",443],[6,"KContextArgs",0],[6,"TrapFrameArgs",0],[5,"Fdt",444],[6,"Option",445],[5,"Vec",446],[1,"never"],[6,"Result",447],[5,"TypeId",448],[5,"VirtPage",125],[5,"PhysAddr",125],[5,"VirtAddr",125],[6,"Ordering",449],[1,"bool"],[1,"u8"],[1,"slice"],[5,"CStr",450],[5,"String",451],[5,"DebugConsole",236],[1,"str"],[5,"LazyInit",283],[10,"Debug",443],[5,"MappingFlags",301],[5,"PageTableWrapper",301],[1,"u64"],[17,"Item"],[10,"IntoIterator",452],[6,"MappingSize",301],[10,"Hasher",453],[5,"Iter",454],[5,"IterNames",454],[5,"Time",424],[5,"Instruction",247],[5,"IRQ",256],[5,"Barrier",264],[5,"MultiCore",274],[5,"TLB",301]],"b":[[129,"impl-Add-for-PhysPage"],[130,"impl-Add%3Cusize%3E-for-PhysPage"],[163,"impl-Display-for-PhysAddr"],[164,"impl-Debug-for-PhysAddr"],[165,"impl-Debug-for-VirtAddr"],[166,"impl-Display-for-VirtAddr"],[167,"impl-Debug-for-PhysPage"],[168,"impl-Display-for-PhysPage"],[169,"impl-Display-for-VirtPage"],[170,"impl-Debug-for-VirtPage"],[173,"impl-From%3CVirtPage%3E-for-VirtAddr"],[174,"impl-From%3Cusize%3E-for-VirtAddr"],[177,"impl-From%3Cusize%3E-for-PhysPage"],[178,"impl-From%3CPhysAddr%3E-for-PhysPage"],[180,"impl-From%3CVirtAddr%3E-for-VirtPage"],[181,"impl-From%3Cusize%3E-for-VirtPage"],[327,"impl-MappingFlags"],[328,"impl-Flags-for-MappingFlags"],[358,"impl-Octal-for-MappingFlags"],[359,"impl-LowerHex-for-MappingFlags"],[360,"impl-UpperHex-for-MappingFlags"],[361,"impl-Debug-for-MappingFlags"],[362,"impl-Binary-for-MappingFlags"],[372,"impl-MappingFlags"],[373,"impl-Flags-for-MappingFlags"]]}\ +}'); +if (typeof window !== 'undefined' && window.initSearch) {window.initSearch(searchIndex)}; +if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex}; diff --git a/settings.html b/settings.html new file mode 100644 index 0000000..b9f4de7 --- /dev/null +++ b/settings.html @@ -0,0 +1 @@ +Settings

Rustdoc settings

Back
\ No newline at end of file diff --git a/src-files.js b/src-files.js new file mode 100644 index 0000000..6fc4763 --- /dev/null +++ b/src-files.js @@ -0,0 +1,4 @@ +var srcIndex = JSON.parse('{\ +"polyhal":["",[["once",[],["mod.rs"]],["riscv64",[["boards",[],["mod.rs"]],["page_table",[],["mod.rs","sigtrx.rs","sv39.rs"]]],["barrier.rs","consts.rs","context.rs","entry.rs","interrupt.rs","kcontext.rs","mod.rs","sbi.rs","timer.rs"]]],["addr.rs","api.rs","consts.rs","debug.rs","instruction.rs","irq.rs","lib.rs","mem.rs","multicore.rs","pagetable.rs","time.rs"]]\ +}'); +createSrcSidebar(); diff --git a/src/polyhal/addr.rs.html b/src/polyhal/addr.rs.html new file mode 100644 index 0000000..db81690 --- /dev/null +++ b/src/polyhal/addr.rs.html @@ -0,0 +1,685 @@ +addr.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+
use core::{
+    ffi::CStr,
+    fmt::{Debug, Display},
+    mem::size_of,
+    ops::Add,
+};
+
+use crate::{pagetable::PageTable, VIRT_ADDR_START};
+
+#[repr(C)]
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct PhysAddr(pub(crate) usize);
+impl From<PhysPage> for PhysAddr {
+    fn from(value: PhysPage) -> Self {
+        Self(value.0 << 12)
+    }
+}
+
+impl PhysAddr {
+    #[inline]
+    pub fn addr(&self) -> usize {
+        self.0
+    }
+
+    #[inline]
+    pub fn get_ptr<T>(&self) -> *const T {
+        (self.0 | VIRT_ADDR_START) as *const T
+    }
+
+    #[inline]
+    pub const fn get_mut_ptr<T>(&self) -> *mut T {
+        (self.0 | VIRT_ADDR_START) as *mut T
+    }
+
+    #[inline]
+    pub fn slice_with_len<T>(&self, len: usize) -> &'static [T] {
+        unsafe { core::slice::from_raw_parts(self.get_ptr(), len) }
+    }
+
+    #[inline]
+    pub fn slice_mut_with_len<T>(&self, len: usize) -> &'static mut [T] {
+        unsafe { core::slice::from_raw_parts_mut(self.get_mut_ptr(), len) }
+    }
+
+    #[inline]
+    pub fn get_cstr(&self) -> &CStr {
+        unsafe { CStr::from_ptr(self.get_ptr::<i8>()) }
+    }
+}
+
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct VirtAddr(pub(crate) usize);
+
+impl From<usize> for VirtAddr {
+    fn from(value: usize) -> Self {
+        Self(value)
+    }
+}
+
+impl From<VirtAddr> for usize {
+    fn from(value: VirtAddr) -> Self {
+        value.0
+    }
+}
+
+impl VirtAddr {
+    #[inline]
+    pub fn addr(&self) -> usize {
+        self.0
+    }
+
+    #[inline]
+    pub fn get_ptr<T>(&self) -> *const T {
+        self.0 as *const T
+    }
+
+    #[inline]
+    pub fn get_mut_ptr<T>(&self) -> *mut T {
+        self.0 as *mut T
+    }
+
+    #[inline]
+    pub fn get_ref<T>(&self) -> &'static T {
+        unsafe { &*(self.0 as *const T) }
+    }
+
+    #[inline]
+    pub fn get_mut_ref<T>(&self) -> &'static mut T {
+        unsafe { &mut *(self.0 as *mut T) }
+    }
+
+    #[inline]
+    pub fn slice_with_len<T>(&self, len: usize) -> &'static [T] {
+        unsafe { core::slice::from_raw_parts(self.get_ptr(), len) }
+    }
+
+    #[inline]
+    pub fn slice_mut_with_len<T>(&self, len: usize) -> &'static mut [T] {
+        unsafe { core::slice::from_raw_parts_mut(self.get_mut_ptr(), len) }
+    }
+
+    #[inline]
+    pub fn slice_until<T>(&self, is_valid: fn(T) -> bool) -> &'static mut [T] {
+        let ptr = self.addr() as *mut T;
+        unsafe {
+            let mut len = 0;
+            if !ptr.is_null() {
+                loop {
+                    if !is_valid(ptr.add(len).read()) {
+                        break;
+                    }
+                    len += 1;
+                }
+            }
+            core::slice::from_raw_parts_mut(ptr, len)
+        }
+    }
+
+    #[inline]
+    pub fn get_cstr(&self) -> &CStr {
+        unsafe { CStr::from_ptr(self.get_ptr::<i8>()) }
+    }
+
+    #[inline]
+    pub fn floor(&self) -> Self {
+        Self(self.0 / PageTable::PAGE_SIZE * PageTable::PAGE_SIZE)
+    }
+
+    #[inline]
+    pub fn ceil(&self) -> Self {
+        Self((self.0 + PageTable::PAGE_SIZE - 1) / PageTable::PAGE_SIZE * PageTable::PAGE_SIZE)
+    }
+}
+
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct PhysPage(pub(crate) usize);
+
+impl From<usize> for PhysPage {
+    fn from(value: usize) -> Self {
+        Self(value)
+    }
+}
+
+impl From<PhysAddr> for PhysPage {
+    fn from(value: PhysAddr) -> Self {
+        Self(value.0 >> 12)
+    }
+}
+
+impl From<PhysPage> for usize {
+    fn from(value: PhysPage) -> Self {
+        value.0
+    }
+}
+
+impl Add<PhysPage> for PhysPage {
+    type Output = PhysPage;
+
+    fn add(self, rhs: PhysPage) -> Self::Output {
+        PhysPage(self.0 + rhs.0)
+    }
+}
+
+impl Add<usize> for PhysPage {
+    type Output = PhysPage;
+
+    fn add(self, rhs: usize) -> Self::Output {
+        PhysPage(self.0 + rhs)
+    }
+}
+
+#[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
+pub struct VirtPage(pub(crate) usize);
+impl From<VirtAddr> for VirtPage {
+    fn from(value: VirtAddr) -> Self {
+        Self(value.0 >> 12)
+    }
+}
+impl From<usize> for VirtPage {
+    fn from(value: usize) -> Self {
+        Self(value)
+    }
+}
+
+impl PhysPage {
+    #[inline]
+    pub const fn new(ppn: usize) -> Self {
+        Self(ppn)
+    }
+
+    #[inline]
+    pub const fn from_addr(addr: usize) -> Self {
+        Self(addr >> 12)
+    }
+
+    #[inline]
+    pub const fn to_addr(&self) -> usize {
+        self.0 << 12
+    }
+
+    #[inline]
+    pub const fn get_buffer(&self) -> &'static mut [u8] {
+        unsafe {
+            core::slice::from_raw_parts_mut(
+                (self.0 << 12 | VIRT_ADDR_START) as *mut u8,
+                PageTable::PAGE_SIZE,
+            )
+        }
+    }
+
+    #[inline]
+    pub fn copy_value_from_another(&self, ppn: PhysPage) {
+        self.get_buffer().copy_from_slice(&ppn.get_buffer());
+        #[cfg(c906)]
+        unsafe {
+            asm!(".long 0x0010000b"); // dcache.all
+            asm!(".long 0x01b0000b"); // sync.is
+        }
+        #[cfg(board = "2k1000")]
+        unsafe {
+            core::arch::asm!("dbar 0;ibar 0;")
+        }
+    }
+
+    #[inline]
+    pub fn drop_clear(&self) {
+        // self.get_buffer().fill(0);
+        unsafe {
+            core::slice::from_raw_parts_mut(
+                (self.0 << 12 | VIRT_ADDR_START) as *mut usize,
+                PageTable::PAGE_SIZE / size_of::<usize>(),
+            )
+            .fill(0);
+        }
+        #[cfg(board = "2k1000")]
+        unsafe {
+            core::arch::asm!("dbar 0;ibar 0;")
+        }
+        #[cfg(c906)]
+        unsafe {
+            asm!(".long 0x0010000b"); // dcache.all
+            asm!(".long 0x01b0000b"); // sync.is
+        }
+    }
+
+    #[inline]
+    pub fn as_num(&self) -> usize {
+        self.0
+    }
+}
+
+impl Add<usize> for VirtPage {
+    type Output = VirtPage;
+
+    fn add(self, rhs: usize) -> Self::Output {
+        VirtPage(self.0 + rhs)
+    }
+}
+
+impl From<VirtPage> for VirtAddr {
+    fn from(value: VirtPage) -> Self {
+        Self(value.to_addr())
+    }
+}
+
+impl PhysAddr {
+    #[inline]
+    pub const fn new(addr: usize) -> Self {
+        Self(addr)
+    }
+}
+
+impl VirtPage {
+    #[inline]
+    pub const fn new(vpn: usize) -> Self {
+        Self(vpn)
+    }
+
+    #[inline]
+    pub const fn from_addr(addr: usize) -> Self {
+        Self(addr >> 12)
+    }
+    #[inline]
+    pub const fn to_addr(&self) -> usize {
+        self.0 << 12
+    }
+}
+
+impl VirtAddr {
+    #[inline]
+    pub const fn new(addr: usize) -> Self {
+        Self(addr)
+    }
+}
+
+impl Display for PhysPage {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
+impl Display for PhysAddr {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
+impl Display for VirtPage {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
+impl Display for VirtAddr {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
+impl Debug for PhysPage {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
+impl Debug for PhysAddr {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
+impl Debug for VirtPage {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
+impl Debug for VirtAddr {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.write_fmt(format_args!("{:#x}", self.0))
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/api.rs.html b/src/polyhal/api.rs.html new file mode 100644 index 0000000..f4625cd --- /dev/null +++ b/src/polyhal/api.rs.html @@ -0,0 +1,39 @@ +api.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+
use crate::addr::PhysPage;
+use crate::{TrapFrame, TrapType, PAGE_ALLOC};
+
+extern "Rust" {
+    pub(crate) fn _main_for_arch(hartid: usize);
+    pub(crate) fn _interrupt_for_arch(ctx: &mut TrapFrame, trap_type: TrapType);
+}
+
+/// alloc a persistent memory page
+#[inline]
+pub(crate) fn frame_alloc() -> PhysPage {
+    PAGE_ALLOC.alloc()
+}
+
+/// release a frame
+#[inline]
+pub(crate) fn frame_dealloc(ppn: PhysPage) {
+    PAGE_ALLOC.dealloc(ppn)
+}
+
\ No newline at end of file diff --git a/src/polyhal/consts.rs.html b/src/polyhal/consts.rs.html new file mode 100644 index 0000000..bfd931f --- /dev/null +++ b/src/polyhal/consts.rs.html @@ -0,0 +1,43 @@ +consts.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+
use core::mem::size_of;
+
+use crate::TrapFrame;
+
+/// Boot Stack Size.
+/// TODO: reduce the boot stack size. Map stack in boot step.
+pub const STACK_SIZE: usize = 0x8_0000;
+
+/// The size of the trap frame(diffent in each architecture.).
+pub const TRAPFRAME_SIZE: usize = size_of::<TrapFrame>();
+
+/// bit macro will generate the number through a shift value.
+///
+/// Here is an example.
+/// You can use bit!(0) instead of 1 << 0.
+/// bit!(39) instead of 1 << 39.
+macro_rules! bit {
+    ($x:expr) => {
+        1 << $x
+    };
+}
+
\ No newline at end of file diff --git a/src/polyhal/debug.rs.html b/src/polyhal/debug.rs.html new file mode 100644 index 0000000..7e32b10 --- /dev/null +++ b/src/polyhal/debug.rs.html @@ -0,0 +1,49 @@ +debug.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+
use core::fmt::Write;
+
+/// This is a console for debugging,
+/// If you want to use this logging
+/// You need to use like this:
+///
+/// #### Put a char to output device(always uart)
+/// ```rust
+/// DebugConsole::putchar(b'3');
+/// ```
+///
+/// ### Get a char from input device(always uart)
+/// ```rust
+/// DebugConsole::getchar();
+/// ```
+pub struct DebugConsole;
+
+// Write string through DebugConsole
+impl Write for DebugConsole {
+    fn write_str(&mut self, s: &str) -> core::fmt::Result {
+        s.as_bytes().into_iter().for_each(|x| Self::putchar(*x));
+        Ok(())
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/instruction.rs.html b/src/polyhal/instruction.rs.html new file mode 100644 index 0000000..309b224 --- /dev/null +++ b/src/polyhal/instruction.rs.html @@ -0,0 +1,9 @@ +instruction.rs - source
1
+2
+3
+4
+
/// Platform Instruction
+/// [Instruction::ebreak] Intruction Breakpoint
+///
+pub struct Instruction;
+
\ No newline at end of file diff --git a/src/polyhal/irq.rs.html b/src/polyhal/irq.rs.html new file mode 100644 index 0000000..9f0d8e7 --- /dev/null +++ b/src/polyhal/irq.rs.html @@ -0,0 +1,47 @@ +irq.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+
/// IRQ interface for exposing.
+///
+/// TODO: Implement this interface.
+///
+/// How to use this interface.
+/// ```rust
+/// // Init irq
+/// IRQ::init();
+///
+/// // Enable irq 3
+/// IRQ::enable(3);
+///
+/// // Disable irq 3
+/// IRQ::disable(3);
+///
+/// // Check if irq is enabled
+/// // Return true if the irq is enabled.
+/// IRQ::enabled(3);
+///
+/// ```
+pub struct IRQ;
+
+impl IRQ {}
+
\ No newline at end of file diff --git a/src/polyhal/lib.rs.html b/src/polyhal/lib.rs.html new file mode 100644 index 0000000..43de75a --- /dev/null +++ b/src/polyhal/lib.rs.html @@ -0,0 +1,563 @@ +lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+
#![no_std]
+#![no_main]
+#![feature(naked_functions)]
+#![feature(asm_const)]
+#![feature(stdsimd)]
+#![feature(const_mut_refs)]
+#![feature(const_slice_from_raw_parts_mut)]
+#![cfg_attr(target_arch = "riscv64", feature(riscv_ext_intrinsics))]
+#![cfg_attr(target_arch = "aarch64", feature(const_option))]
+
+//! This is a crate to help you supporting multiple platforms.
+//!
+//! If you want to use this crate, you should implement the following trait in your code.
+//!
+//! ```rust
+//! /// impl
+//! pub struct PageAllocImpl;
+//!
+//! impl PageAlloc for PageAllocImpl {
+//!     fn alloc(&self) -> PhysPage {
+//!         frame_alloc()
+//!     }
+//!
+//!     fn dealloc(&self, ppn: PhysPage) {
+//!         frame::frame_dealloc(ppn)
+//!     }
+//! }
+//!
+//! /// kernel interrupt
+//! #[polyhal::arch_interrupt]
+//! fn kernel_interrupt(ctx: &mut TrapFrame, trap_type: TrapType) {
+//!     // println!("trap_type @ {:x?} {:#x?}", trap_type, ctx);
+//!     match trap_type {
+//!         Breakpoint => return,
+//!         UserEnvCall => {
+//!             // jump to next instruction anyway
+//!             ctx.syscall_ok();
+//!             log::info!("Handle a syscall");
+//!         }
+//!         StorePageFault(_paddr) | LoadPageFault(_paddr) | InstructionPageFault(_paddr) => {
+//!             log::info!("page fault");
+//!         }
+//!         IllegalInstruction(_) => {
+//!             log::info!("illegal instruction");
+//!         }
+//!         Time => {
+//!             log::info!("Timer");
+//!         }
+//!         _ => {
+//!             log::warn!("unsuspended trap type: {:?}", trap_type);
+//!         }
+//!     }
+//! }
+//!
+//! #[polyhal::arch_entry]
+//! /// kernel main function, entry point.
+//! fn main(hartid: usize) {
+//!     if hartid != 0 {
+//!         return;
+//!     }
+//!
+//!     println!("[kernel] Hello, world!");
+//!     allocator::init_allocator();
+//!     logging::init(Some("trace"));
+//!     println!("init logging");
+//!
+//!     // Init page alloc for polyhal
+//!     polyhal::init(&PageAllocImpl);
+//!
+//!     polyhal::init_interrupt();
+//!
+//!     get_mem_areas().into_iter().for_each(|(start, size)| {
+//!         println!("init memory region {:#x} - {:#x}", start, start + size);
+//!         frame::add_frame_range(start, start + size);
+//!     });
+//!     panic!("end of rust_main!");
+//! }
+//!
+//! ```
+//!
+//! The main(hardid: usize) is the entry point.
+//!
+//! You can find details in the example.
+//!
+//! In this crate you can find some interfaces to use.
+//! These interfaces are classified into some structures.
+//!
+//! [PhysPage]: PhysicalPage And its associated functions.
+//!
+//! [PhysAddr](addr::PhysAddr): PhysicalAddr And its associated functions.
+//!
+//! [VirtPage](addr::VirtPage): VirtualPage And its associated functions.
+//!
+//! [VirtAddr](addr::VirtAddr): VirtualAddr And its associated functions.
+//!
+//! [IRQ](irq::IRQ): Interrupt ReQuest management, includes enable and disable.
+//!
+//! [Barrier](mem::Barrier): Memory barrier operations.
+//!
+//! [MultiCore](multicore::MultiCore): MultiCore operations. Now only [multicore::MultiCore::boot_all] is available.
+//!
+//! [PageTable]: PageTable and its associated functions.
+//!
+//! [MappingFlags](pagetable::MappingFlags): MappingFlags, This is an abstraction of pagetable flags.
+//!
+//! [TLB](pagetable::TLB): TLB operations.
+//!
+//! [PageTableWrapper](pagetable::PageTableWrapper): PageTableWrapper. It will dealloc all pagetable leaf when it was dropping.
+//!
+//! [Time](time::Time): Time and its associated functions.
+//!
+//! [Instruction](instruction::Instruction): Some platform instruction.
+//!
+//! There also provides a debugging console(recommanded only for debugging).
+//!
+//! [DebugConsole](debug::DebugConsole): A console for debugging.
+//!
+//! This crate provides a [TrapFrame], you can operate it through index with [TrapFrameArgs].
+//!
+//! If you are using kernel task. You should to enable feature `kcontext`.
+//! Then you can use kernel task context structure [KContext], and manipulate it with [KContextArgs].
+//!
+//! You can switch kcontext through [context_switch_pt] or [context_switch]
+//!
+//! There are also some consts.
+//!
+//! [VIRT_ADDR_START]: This is a higher half kernel offset address.
+//! [USER_VADDR_END]: End of the user address range.
+//! [PAGE_SIZE]: The size of the page.
+//!
+//! You can get some device information using the functions below.
+//! [get_mem_areas]: Get the avaliable memorys.
+//! [get_fdt]: Get the Fdt structure(fdt is a rust dtb operation crate).
+//! [get_cpu_num]: Get the number of cpus.
+//!
+//! TIPS: You should have finished [init] before using [get_mem_areas] and [get_fdt].
+
+extern crate alloc;
+
+#[macro_use]
+extern crate log;
+
+pub mod addr;
+pub mod api;
+#[macro_use]
+pub mod consts;
+pub mod debug;
+pub mod instruction;
+pub mod irq;
+pub mod mem;
+#[cfg(feature = "multicore")]
+pub mod multicore;
+pub mod once;
+pub mod pagetable;
+pub mod time;
+use core::mem::size_of;
+
+use addr::PhysPage;
+use alloc::vec::Vec;
+
+use consts::STACK_SIZE;
+use fdt::Fdt;
+use once::LazyInit;
+use pagetable::PageTable;
+pub use percpu;
+
+#[cfg_attr(target_arch = "riscv64", path = "riscv64/mod.rs")]
+#[cfg_attr(target_arch = "aarch64", path = "aarch64/mod.rs")]
+#[cfg_attr(target_arch = "x86_64", path = "x86_64/mod.rs")]
+#[cfg_attr(target_arch = "loongarch64", path = "loongarch64/mod.rs")]
+mod currrent_arch;
+
+/// Trap Frame
+pub use currrent_arch::TrapFrame;
+
+pub use currrent_arch::*;
+
+pub use polyhal_macro::{arch_entry, arch_interrupt};
+
+pub const PAGE_SIZE: usize = PageTable::PAGE_SIZE;
+pub const USER_VADDR_END: usize = PageTable::USER_VADDR_END;
+
+/// Kernel Context Arg Type.
+///
+/// Using this by Index and IndexMut trait bound on KContext.
+#[derive(Debug)]
+#[cfg(feature = "kcontext")]
+pub enum KContextArgs {
+    /// Kernel Stack Pointer
+    KSP,
+    /// Kernel Thread Pointer
+    KTP,
+    /// Kernel Program Counter
+    KPC,
+}
+
+/// Trap Frame Arg Type
+///
+/// Using this by Index and IndexMut trait bound on TrapFrame
+#[derive(Debug)]
+pub enum TrapFrameArgs {
+    SEPC,
+    RA,
+    SP,
+    RET,
+    ARG0,
+    ARG1,
+    ARG2,
+    TLS,
+    SYSCALL,
+}
+
+#[derive(Debug, Clone, Copy)]
+pub enum TrapType {
+    Breakpoint,
+    UserEnvCall,
+    Time,
+    Unknown,
+    SupervisorExternal,
+    StorePageFault(usize),
+    LoadPageFault(usize),
+    InstructionPageFault(usize),
+    IllegalInstruction(usize),
+}
+
+#[link_section = ".bss.stack"]
+static mut BOOT_STACK: [u8; STACK_SIZE] = [0; STACK_SIZE];
+
+pub(crate) fn clear_bss() {
+    extern "C" {
+        fn _sbss();
+        fn _ebss();
+    }
+    unsafe {
+        core::slice::from_raw_parts_mut(
+            _sbss as usize as *mut u128,
+            (_ebss as usize - _sbss as usize) / size_of::<u128>(),
+        )
+        .fill(0);
+    }
+}
+
+pub trait PageAlloc: Sync {
+    fn alloc(&self) -> PhysPage;
+    fn dealloc(&self, ppn: PhysPage);
+}
+
+static PAGE_ALLOC: LazyInit<&dyn PageAlloc> = LazyInit::new();
+
+/// Init arch with page allocator, like log crate
+/// Please initialize the allocator before calling this function.
+pub fn init(page_alloc: &'static dyn PageAlloc) {
+    PAGE_ALLOC.init_by(page_alloc);
+
+    // Init current architecture
+    currrent_arch::arch_init();
+}
+
+/// Store the number of cpu, this will fill up by startup function.
+pub(crate) static CPU_NUM: LazyInit<usize> = LazyInit::new();
+
+/// Store the memory area, this will fill up by the arch_init() function in each architecture.
+pub(crate) static MEM_AREA: LazyInit<Vec<(usize, usize)>> = LazyInit::new();
+
+/// Store the DTB_area, this will fill up by the arch_init() function in each architecture
+static DTB_BIN: LazyInit<Vec<u8>> = LazyInit::new();
+
+/// Get the memory area, this function should be called after initialization
+pub fn get_mem_areas() -> Vec<(usize, usize)> {
+    MEM_AREA.clone()
+}
+
+/// Get the fdt
+pub fn get_fdt() -> Option<Fdt<'static>> {
+    Fdt::new(&DTB_BIN).ok()
+}
+
+/// Get the number of cpus
+pub fn get_cpu_num() -> usize {
+    *CPU_NUM
+}
+
\ No newline at end of file diff --git a/src/polyhal/mem.rs.html b/src/polyhal/mem.rs.html new file mode 100644 index 0000000..beb3b9f --- /dev/null +++ b/src/polyhal/mem.rs.html @@ -0,0 +1,13 @@ +mem.rs - source
1
+2
+3
+4
+5
+6
+
/// This is a barrier function.
+///
+/// This struct has two functions.
+/// [`Barrier::complete_sync`]: ensures the correct sequencing of instructions
+/// [`Barrier::ordering_sync`]: ensures the visibility and consistency of memory operations
+pub struct Barrier;
+
\ No newline at end of file diff --git a/src/polyhal/multicore.rs.html b/src/polyhal/multicore.rs.html new file mode 100644 index 0000000..3f3e6a1 --- /dev/null +++ b/src/polyhal/multicore.rs.html @@ -0,0 +1,31 @@ +multicore.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+
/// This is a leader for the multicore operation
+///
+/// You can use this function to use the multicore operation
+///
+/// Boot other calls after the multicore
+/// If you use this function call, you should call it after arch::init(..);
+/// This function will allocate the stack and map it for itself.
+///
+/// ```rust
+/// Multicore::boot_all();
+/// ```
+///
+/// Here will have more functionality about multicore in the future.
+///
+pub struct MultiCore;
+
\ No newline at end of file diff --git a/src/polyhal/once/mod.rs.html b/src/polyhal/once/mod.rs.html new file mode 100644 index 0000000..7f31e6a --- /dev/null +++ b/src/polyhal/once/mod.rs.html @@ -0,0 +1,223 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+
use core::cell::UnsafeCell;
+use core::fmt;
+use core::mem::MaybeUninit;
+use core::ops::{Deref, DerefMut};
+use core::sync::atomic::{AtomicBool, Ordering};
+
+pub struct LazyInit<T> {
+    inited: AtomicBool,
+    data: UnsafeCell<MaybeUninit<T>>,
+}
+
+unsafe impl<T: Send + Sync> Sync for LazyInit<T> {}
+unsafe impl<T: Send> Send for LazyInit<T> {}
+
+impl<T> LazyInit<T> {
+    pub const fn new() -> Self {
+        Self {
+            inited: AtomicBool::new(false),
+            data: UnsafeCell::new(MaybeUninit::uninit()),
+        }
+    }
+
+    pub fn init_by(&self, data: T) {
+        assert!(!self.is_init());
+        unsafe { (*self.data.get()).as_mut_ptr().write(data) };
+        self.inited.store(true, Ordering::Release);
+    }
+
+    pub fn is_init(&self) -> bool {
+        self.inited.load(Ordering::Acquire)
+    }
+
+    pub fn try_get(&self) -> Option<&T> {
+        if self.is_init() {
+            unsafe { Some(&*(*self.data.get()).as_ptr()) }
+        } else {
+            None
+        }
+    }
+
+    fn check_init(&self) {
+        if !self.is_init() {
+            panic!(
+                "Use uninitialized value: {:?}",
+                core::any::type_name::<Self>()
+            )
+        }
+    }
+
+    #[inline]
+    fn get(&self) -> &T {
+        self.check_init();
+        unsafe { self.get_unchecked() }
+    }
+
+    #[inline]
+    fn get_mut(&mut self) -> &mut T {
+        self.check_init();
+        unsafe { self.get_mut_unchecked() }
+    }
+
+    /// # Safety
+    ///
+    /// Must be called after initialization.
+    #[inline]
+    pub unsafe fn get_unchecked(&self) -> &T {
+        &*(*self.data.get()).as_ptr()
+    }
+
+    /// # Safety
+    ///
+    /// Must be called after initialization.
+    #[inline]
+    pub unsafe fn get_mut_unchecked(&mut self) -> &mut T {
+        &mut *(*self.data.get()).as_mut_ptr()
+    }
+}
+
+impl<T: fmt::Debug> fmt::Debug for LazyInit<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self.try_get() {
+            Some(s) => write!(f, "LazyInit {{ data: ")
+                .and_then(|()| s.fmt(f))
+                .and_then(|()| write!(f, "}}")),
+            None => write!(f, "LazyInit {{ <uninitialized> }}"),
+        }
+    }
+}
+
+impl<T> Deref for LazyInit<T> {
+    type Target = T;
+    #[inline]
+    fn deref(&self) -> &T {
+        self.get()
+    }
+}
+
+impl<T> DerefMut for LazyInit<T> {
+    #[inline]
+    fn deref_mut(&mut self) -> &mut T {
+        self.get_mut()
+    }
+}
+
+impl<T> Drop for LazyInit<T> {
+    fn drop(&mut self) {
+        if self.is_init() {
+            unsafe { core::ptr::drop_in_place((*self.data.get()).as_mut_ptr()) };
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/pagetable.rs.html b/src/polyhal/pagetable.rs.html new file mode 100644 index 0000000..c41846f --- /dev/null +++ b/src/polyhal/pagetable.rs.html @@ -0,0 +1,723 @@ +pagetable.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+
use core::ops::Deref;
+
+use crate::addr::{PhysAddr, PhysPage, VirtAddr, VirtPage};
+use crate::api::{frame_alloc, frame_dealloc};
+
+bitflags::bitflags! {
+    /// Mapping flags for page table.
+    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+    pub struct MappingFlags: u64 {
+        /// Persent
+        const P = bit!(0);
+        /// User Accessable Flag
+        const U = bit!(1);
+        /// Readable Flag
+        const R = bit!(2);
+        /// Writeable Flag
+        const W = bit!(3);
+        /// Executeable Flag
+        const X = bit!(4);
+        /// Accessed Flag
+        const A = bit!(5);
+        /// Dirty Flag, indicating that the page was written
+        const D = bit!(6);
+        /// Global Flag
+        const G = bit!(7);
+        /// Device Flag, indicating that the page was used for device memory
+        const Device = bit!(8);
+        /// Cache Flag, indicating that the page will be cached
+        const Cache = bit!(9);
+
+        /// Read | Write | Executeable Flags
+        const RWX = Self::R.bits() | Self::W.bits() | Self::X.bits();
+        /// User | Read | Write Flags
+        const URW = Self::U.bits() | Self::R.bits() | Self::W.bits();
+        /// User | Read | Executeable Flags
+        const URX = Self::U.bits() | Self::R.bits() | Self::X.bits();
+        /// User | Read | Write | Executeable Flags
+        const URWX = Self::URW.bits() | Self::X.bits();
+    }
+}
+
+/// This structure indicates size of the page that will be mapped.
+///
+/// TODO: Support More Page Size, 16KB or 32KB
+/// Just support 4KB right now.
+#[derive(Debug)]
+pub enum MappingSize {
+    Page4KB,
+    // Page2MB,
+    // Page1GB,
+}
+
+/// Page table entry structure
+///
+/// Just define here. Should implement functions in specific architectures.
+#[derive(Copy, Clone, Debug)]
+pub(crate) struct PTE(pub usize);
+
+/// Page Table
+///
+/// This is just the page table defination.
+/// The implementation of the page table in the specific architecture mod.
+/// Such as:
+/// x86_64/page_table.rs
+/// riscv64/page_table/sv39.rs
+/// aarch64/page_table.rs
+/// loongarch64/page_table.rs
+#[repr(C)]
+#[derive(Debug, Clone, Copy)]
+pub struct PageTable(pub(crate) PhysAddr);
+
+impl PageTable {
+    /// Get the page table list through the physical address
+    #[inline]
+    pub(crate) fn get_pte_list(paddr: PhysAddr) -> &'static mut [PTE] {
+        paddr.slice_mut_with_len::<PTE>(Self::PTE_NUM_IN_PAGE)
+    }
+
+    /// Mapping a page to specific virtual page (user space address).
+    ///
+    /// Ensure that PageTable is which you want to map.
+    /// vpn: Virtual page will be mapped.
+    /// ppn: Physical page.
+    /// flags: Mapping flags, include Read, Write, Execute and so on.
+    /// size: MappingSize. Just support 4KB page currently.
+    pub fn map_page(&self, vpn: VirtPage, ppn: PhysPage, flags: MappingFlags, _size: MappingSize) {
+        assert!(
+            vpn.to_addr() <= Self::USER_VADDR_END,
+            "You only should use the address limited by user"
+        );
+        assert!(Self::PAGE_LEVEL >= 3, "Just level >= 3 supported currently");
+        let mut pte_list = Self::get_pte_list(self.0);
+        if Self::PAGE_LEVEL == 4 {
+            let pte = &mut pte_list[vpn.pn_index(3)];
+            if !pte.is_valid() {
+                *pte = PTE::new_table(frame_alloc());
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 3
+        {
+            let pte = &mut pte_list[vpn.pn_index(2)];
+            if !pte.is_valid() {
+                *pte = PTE::new_table(frame_alloc());
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 2
+        {
+            let pte = &mut pte_list[vpn.pn_index(1)];
+            if !pte.is_valid() {
+                *pte = PTE::new_table(frame_alloc());
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 1, map page
+        pte_list[vpn.pn_index(0)] = PTE::new_page(ppn, flags.into());
+        TLB::flush_vaddr(vpn.into());
+    }
+
+    /// Mapping a page to specific address(kernel space address).
+    ///
+    /// TODO: This method is not implemented.
+    /// TIPS: If we mapped to kernel, the page will be shared between different pagetable.
+    ///
+    /// Ensure that PageTable is which you want to map.
+    /// vpn: Virtual page will be mapped.
+    /// ppn: Physical page.
+    /// flags: Mapping flags, include Read, Write, Execute and so on.
+    /// size: MappingSize. Just support 4KB page currently.    
+    ///
+    /// How to implement shared.
+    pub fn map_kernel(
+        &self,
+        vpn: VirtPage,
+        ppn: PhysPage,
+        flags: MappingFlags,
+        _size: MappingSize,
+    ) {
+        assert!(
+            vpn.to_addr() >= Self::KERNEL_VADDR_START,
+            "Virt page should greater than Self::KERNEL_VADDR_START"
+        );
+        assert!(Self::PAGE_LEVEL >= 3, "Just level >= 3 supported currently");
+        let mut pte_list = Self::get_pte_list(self.0);
+        if Self::PAGE_LEVEL == 4 {
+            let pte = &mut pte_list[vpn.pn_index(3)];
+            if !pte.is_valid() {
+                *pte = PTE::new_table(frame_alloc());
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 3
+        {
+            let pte = &mut pte_list[vpn.pn_index(2)];
+            if !pte.is_valid() {
+                *pte = PTE::new_table(frame_alloc());
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 2
+        {
+            let pte = &mut pte_list[vpn.pn_index(1)];
+            if !pte.is_valid() {
+                *pte = PTE::new_table(frame_alloc());
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 1, map page
+        pte_list[vpn.pn_index(0)] = PTE::new_page(ppn, flags.into());
+        TLB::flush_vaddr(vpn.into());
+    }
+
+    /// Unmap a page from specific virtual page (user space address).
+    ///
+    /// Ensure the virtual page is exists.
+    /// vpn: Virtual address.
+    pub fn unmap_page(&self, vpn: VirtPage) {
+        let mut pte_list = Self::get_pte_list(self.0);
+        if Self::PAGE_LEVEL == 4 {
+            let pte = &mut pte_list[vpn.pn_index(3)];
+            if !pte.is_table() {
+                return;
+            };
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 3
+        {
+            let pte = &mut pte_list[vpn.pn_index(2)];
+            if !pte.is_table() {
+                return;
+            };
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 2
+        {
+            let pte = &mut pte_list[vpn.pn_index(1)];
+            if !pte.is_table() {
+                return;
+            };
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 1, map page
+        pte_list[vpn.pn_index(0)] = PTE(0);
+        TLB::flush_vaddr(vpn.into());
+    }
+
+    /// Translate a virtual adress to a physical address and mapping flags.
+    ///
+    /// Return None if the vaddr isn't mapped.
+    /// vpn: The virtual address will be translated.
+    pub fn translate(&self, vaddr: VirtAddr) -> Option<(PhysAddr, MappingFlags)> {
+        let vpn: VirtPage = vaddr.into();
+        let mut pte_list = Self::get_pte_list(self.0);
+        if Self::PAGE_LEVEL == 4 {
+            let pte = &mut pte_list[vpn.pn_index(3)];
+            if !pte.is_table() {
+                return None;
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 3
+        {
+            let pte = &mut pte_list[vpn.pn_index(2)];
+            if !pte.is_table() {
+                return None;
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 2
+        {
+            let pte = &mut pte_list[vpn.pn_index(1)];
+            if !pte.is_table() {
+                return None;
+            }
+            pte_list = Self::get_pte_list(pte.address());
+        }
+        // level 1, map page
+        let pte = pte_list[vpn.pn_index(0)];
+        Some((
+            PhysAddr(pte.address().0 + vaddr.pn_offest(0)),
+            pte.flags().into(),
+        ))
+    }
+
+    /// Release the page table entry.
+    ///
+    /// The page table entry in the user space address will be released.
+    /// [Page Table Wikipedia](https://en.wikipedia.org/wiki/Page_table).
+    /// You don't need to care about this if you just want to use.
+    pub fn release(&self) {
+        let drop_l2 = |pte_list: &[PTE]| {
+            pte_list.iter().for_each(|x| {
+                if x.is_table() {
+                    frame_dealloc(x.address().into());
+                }
+            });
+        };
+        let drop_l3 = |pte_list: &[PTE]| {
+            pte_list.iter().for_each(|x| {
+                if x.is_table() {
+                    drop_l2(Self::get_pte_list(x.address()));
+                    frame_dealloc(x.address().into());
+                }
+            });
+        };
+        let drop_l4 = |pte_list: &[PTE]| {
+            pte_list.iter().for_each(|x| {
+                if x.is_table() {
+                    drop_l3(Self::get_pte_list(x.address()));
+                    frame_dealloc(x.address().into());
+                }
+            });
+        };
+
+        // Drop all sub page table entry and clear root page.
+        let pte_list = &mut Self::get_pte_list(self.0)[..Self::GLOBAL_ROOT_PTE_RANGE];
+        if Self::PAGE_LEVEL == 4 {
+            drop_l4(pte_list);
+        } else {
+            drop_l3(pte_list);
+        }
+        pte_list.fill(PTE(0));
+    }
+}
+
+/// TLB Operation set.
+/// Such as flush_vaddr, flush_all.
+/// Just use it in the fn.
+///
+/// there are some methods in the TLB implementation
+///
+/// ### Flush the tlb entry through the specific virtual address
+///
+/// ```rust
+/// TLB::flush_vaddr(arg0);  arg0 should be VirtAddr
+/// ```
+/// ### Flush all tlb entries
+/// ```rust
+/// TLB::flush_all();
+/// ```
+pub struct TLB;
+
+/// Page Table Wrapper
+///
+/// You can use this wrapper to packing PageTable.
+/// If you release the PageTableWrapper,
+/// the PageTable will release its page table entry.
+#[derive(Debug)]
+pub struct PageTableWrapper(pub PageTable);
+
+impl Deref for PageTableWrapper {
+    type Target = PageTable;
+
+    fn deref(&self) -> &Self::Target {
+        &self.0
+    }
+}
+
+/// Allocate a new PageTableWrapper with new page table root
+///
+/// This operation will restore the page table.
+impl PageTableWrapper {
+    /// Alloc a new PageTableWrapper with new page table root
+    /// This operation will copy kernel page table space from booting page table.
+    #[inline]
+    pub fn alloc() -> Self {
+        let pt = PageTable(frame_alloc().into());
+        pt.restore();
+        Self(pt)
+    }
+}
+
+/// Page Table Release.
+///
+/// You must implement this trait to release page table.
+/// Include the page table entry and root page.
+impl Drop for PageTableWrapper {
+    fn drop(&mut self) {
+        self.0.release();
+        frame_dealloc(self.0 .0.into());
+    }
+}
+
+#[cfg(test)]
+/// TODO: use #![feature(custom_test_frameworks)] to
+/// Test this crate.
+mod tests {
+    use core::mem::size_of;
+
+    use crate::pagetable::PageTableWrapper;
+
+    #[test]
+    fn exploration() {
+        assert_eq!(
+            size_of::<PageTableWrapper>(),
+            size_of::<usize>(),
+            "ensure the size of the page table wrapper equas the size of the usize"
+        );
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/barrier.rs.html b/src/polyhal/riscv64/barrier.rs.html new file mode 100644 index 0000000..7385528 --- /dev/null +++ b/src/polyhal/riscv64/barrier.rs.html @@ -0,0 +1,19 @@ +barrier.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+
use crate::mem::Barrier;
+
+impl Barrier {
+    #[inline]
+    pub fn complete_sync() {}
+
+    #[inline]
+    pub fn ordering_sync() {}
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/boards/mod.rs.html b/src/polyhal/riscv64/boards/mod.rs.html new file mode 100644 index 0000000..89ef017 --- /dev/null +++ b/src/polyhal/riscv64/boards/mod.rs.html @@ -0,0 +1,61 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+
cfg_if::cfg_if! {
+    if #[cfg(board = "k210")] {
+        mod k210;
+        pub use k210::*;
+    } else if #[cfg(board = "qemu")] {
+        mod qemu;
+        pub use qemu::*;
+    } else if #[cfg(board = "cv1811h")] {
+        mod cv1811h;
+        pub use cv1811h::*;
+    } else if #[cfg(board = "visionfive2")] {
+        use riscv::register::sstatus;
+        pub const CLOCK_FREQ: usize = 12500000;
+        static DEVICE_TREE: &[u8] = include_bytes!("jh7110-visionfive-v2.dtb");
+        pub fn init_device(hartid: usize, _device_tree: usize) -> (usize, usize) {
+            unsafe {
+                sstatus::set_sum();
+            }
+            (hartid, DEVICE_TREE.as_ptr() as usize)
+        }
+    } else {
+        // compile_error!("not support this board");
+        pub const CLOCK_FREQ: usize = 12500000;
+
+        pub fn init_device(hartid: usize, device_tree: usize) -> (usize, usize) {
+            // warn!("use default board config");
+            (hartid, device_tree)
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/consts.rs.html b/src/polyhal/riscv64/consts.rs.html new file mode 100644 index 0000000..684b19d --- /dev/null +++ b/src/polyhal/riscv64/consts.rs.html @@ -0,0 +1,25 @@ +consts.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+
pub const VIRT_ADDR_START: usize = 0xffff_ffc0_0000_0000;
+pub const SIG_RETURN_ADDR: usize = 0xFFFF_FFC1_0000_0000;
+
+/// Every core has a unique area of memory.
+/// Just using pagetable to map multi core area.
+/// Area size: 0x100_0000 (16MBytes)
+///
+/// First Area is 0xFFFF_FFC2_0000_0000
+/// Next Area is 0xFFFF_FFC2_0100_0000
+/// Others Same as This, so it will support 16 * 16 = 256 cores (Only auxiliary Harts).
+pub const MULTI_CORE_AREA: usize = 0xFFFF_FFC2_0000_0000;
+pub const MULTI_CORE_AREA_SIZE: usize = 0x100_0000;
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/context.rs.html b/src/polyhal/riscv64/context.rs.html new file mode 100644 index 0000000..c2a6780 --- /dev/null +++ b/src/polyhal/riscv64/context.rs.html @@ -0,0 +1,233 @@ +context.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+
use core::{
+    fmt::Debug,
+    ops::{Index, IndexMut},
+};
+
+use riscv::register::sstatus::{self, Sstatus};
+
+use crate::TrapFrameArgs;
+
+#[repr(C)]
+#[derive(Clone)]
+// 上下文
+pub struct TrapFrame {
+    pub x: [usize; 32], // 32 个通用寄存器
+    pub sstatus: Sstatus,
+    pub sepc: usize,
+    pub fsx: [usize; 2],
+}
+
+impl Debug for TrapFrame {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        f.debug_struct("Context")
+            .field("ra", &self.x[1])
+            .field("sp", &self.x[2])
+            .field("gp", &self.x[3])
+            .field("tp", &self.x[4])
+            .field("t0", &self.x[5])
+            .field("t1", &self.x[6])
+            .field("t2", &self.x[7])
+            .field("s0", &self.x[8])
+            .field("s1", &self.x[9])
+            .field("a0", &self.x[10])
+            .field("a1", &self.x[11])
+            .field("a2", &self.x[12])
+            .field("a3", &self.x[13])
+            .field("a4", &self.x[14])
+            .field("a5", &self.x[15])
+            .field("a6", &self.x[16])
+            .field("a7", &self.x[17])
+            .field("s2", &self.x[18])
+            .field("s3", &self.x[19])
+            .field("s4", &self.x[20])
+            .field("s5", &self.x[21])
+            .field("s6", &self.x[22])
+            .field("s7", &self.x[23])
+            .field("s8", &self.x[24])
+            .field("s9", &self.x[25])
+            .field("s10", &self.x[26])
+            .field("s11", &self.x[27])
+            .field("t3", &self.x[28])
+            .field("t4", &self.x[29])
+            .field("t5", &self.x[30])
+            .field("t6", &self.x[31])
+            .field("sstatus", &self.sstatus)
+            .field("sepc", &self.sepc)
+            .field("fsx", &self.fsx)
+            .finish()
+    }
+}
+
+impl TrapFrame {
+    // 创建上下文信息
+    #[inline]
+    pub fn new() -> Self {
+        TrapFrame {
+            x: [0usize; 32],
+            sstatus: sstatus::read(),
+            sepc: 0,
+            fsx: [0; 2],
+        }
+    }
+
+    #[inline]
+    pub fn args(&self) -> [usize; 6] {
+        self.x[10..16].try_into().expect("args slice force convert")
+    }
+
+    #[inline]
+    pub fn syscall_ok(&mut self) {
+        self.sepc += 4;
+    }
+}
+
+impl Index<TrapFrameArgs> for TrapFrame {
+    type Output = usize;
+
+    fn index(&self, index: TrapFrameArgs) -> &Self::Output {
+        match index {
+            TrapFrameArgs::SEPC => &self.sepc,
+            TrapFrameArgs::RA => &self.x[1],
+            TrapFrameArgs::SP => &self.x[2],
+            TrapFrameArgs::RET => &self.x[10],
+            TrapFrameArgs::ARG0 => &self.x[10],
+            TrapFrameArgs::ARG1 => &self.x[11],
+            TrapFrameArgs::ARG2 => &self.x[12],
+            TrapFrameArgs::TLS => &self.x[4],
+            TrapFrameArgs::SYSCALL => &self.x[17],
+        }
+    }
+}
+
+impl IndexMut<TrapFrameArgs> for TrapFrame {
+    fn index_mut(&mut self, index: TrapFrameArgs) -> &mut Self::Output {
+        match index {
+            TrapFrameArgs::SEPC => &mut self.sepc,
+            TrapFrameArgs::RA => &mut self.x[1],
+            TrapFrameArgs::SP => &mut self.x[2],
+            TrapFrameArgs::RET => &mut self.x[10],
+            TrapFrameArgs::ARG0 => &mut self.x[10],
+            TrapFrameArgs::ARG1 => &mut self.x[11],
+            TrapFrameArgs::ARG2 => &mut self.x[12],
+            TrapFrameArgs::TLS => &mut self.x[4],
+            TrapFrameArgs::SYSCALL => &mut self.x[17],
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/entry.rs.html b/src/polyhal/riscv64/entry.rs.html new file mode 100644 index 0000000..ce92567 --- /dev/null +++ b/src/polyhal/riscv64/entry.rs.html @@ -0,0 +1,301 @@ +entry.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+
use core::arch::riscv64::sfence_vma_all;
+
+use crate::pagetable::{PageTable, PTE};
+use crate::VIRT_ADDR_START;
+
+use super::page_table::PTEFlags;
+
+#[link_section = ".data.prepage.entry"]
+pub(crate) static mut PAGE_TABLE: [PTE; PageTable::PTE_NUM_IN_PAGE] = {
+    let mut arr: [PTE; PageTable::PTE_NUM_IN_PAGE] = [PTE(0); PageTable::PTE_NUM_IN_PAGE];
+    // 初始化页表信息
+    // 0x00000000_80000000 -> 0x80000000 (1G)
+    // 高半核
+    // 0xffffffc0_00000000 -> 0x00000000 (1G)
+    // 0xffffffc0_80000000 -> 0x80000000 (1G)
+
+    // arr[0] = PTE::from_addr(0x0000_0000, PTEFlags::VRWX);
+    // arr[1] = PTE::from_addr(0x4000_0000, PTEFlags::VRWX);
+    arr[2] = PTE::from_addr(0x8000_0000, PTEFlags::ADVRWX);
+    arr[0x100] = PTE::from_addr(0x0000_0000, PTEFlags::ADGVRWX);
+    arr[0x101] = PTE::from_addr(0x4000_0000, PTEFlags::ADGVRWX);
+    arr[0x102] = PTE::from_addr(0x8000_0000, PTEFlags::ADGVRWX);
+    arr[0x103] = PTE::from_addr(0xc000_0000, PTEFlags::ADGVRWX);
+    arr[0x104] = PTE::from_addr(0x1_0000_0000, PTEFlags::ADGVRWX);
+    arr[0x105] = PTE::from_addr(0x1_4000_0000, PTEFlags::ADGVRWX);
+    arr[0x106] = PTE::from_addr(0x8000_0000, PTEFlags::ADVRWX);
+    arr
+};
+
+/// 汇编入口函数
+///
+/// 分配栈 初始化页表信息 并调到rust入口函数
+#[naked]
+#[no_mangle]
+#[link_section = ".text.entry"]
+unsafe extern "C" fn _start() -> ! {
+    core::arch::asm!(
+        // Chcek boot core
+        "
+            beqz    a0, 2f
+        ",
+        // Ensure that boot core is 0
+        "1:
+            // li      a7, 0x48534D
+            // li      a6, 0
+            // li      a0, 0
+            // mv      a2, a1
+            // la      a1, _start
+            // ecall
+            // li      a7, 0x48534D
+            // li      a6, 1   // 0: START, 1: STOP, 2: STATUS
+            // li      a0, 0
+            // mv      a2, a1
+            // la      a1, _start
+            // ecall
+            // wfi
+            // la      ra, 1b
+            // ret
+        ",
+        // 1. 设置栈信息
+        // sp = bootstack + (hartid + 1) * 0x10000
+        "2:
+            la      sp, {boot_stack}
+            li      t0, {stack_size}
+            add     sp, sp, t0              // set boot stack
+
+            li      s0, {virt_addr_start}   // add virtual address
+            or      sp, sp, s0
+        ",
+        // 2. 开启分页模式
+        // satp = (8 << 60) | PPN(page_table)
+        "
+            la      t0, {page_table}
+            srli    t0, t0, 12
+            li      t1, 8 << 60
+            or      t0, t0, t1
+            csrw    satp, t0
+            sfence.vma
+        ",
+        // 3. 跳到 rust_main 函数,绝对路径
+        "
+            la      a2, {entry}
+            or      a2, a2, s0
+            jalr    a2                      // call rust_main
+        ",
+        stack_size = const crate::STACK_SIZE,
+        boot_stack = sym crate::BOOT_STACK,
+        page_table = sym PAGE_TABLE,
+        entry = sym super::rust_main,
+        virt_addr_start = const VIRT_ADDR_START,
+        options(noreturn),
+    )
+}
+
+/// 汇编函数入口
+///
+/// 初始化也表信息 并调到 rust_secondary_main 入口函数
+#[naked]
+#[no_mangle]
+pub(crate) unsafe extern "C" fn secondary_start() -> ! {
+    core::arch::asm!(
+        // 1. 设置栈信息
+        // sp = bootstack + (hartid + 1) * 0x10000
+        "
+            mv      s6, a0
+            mv      sp, a1
+
+            li      s0, {virt_addr_start}   // add virtual address
+            or      sp, sp, s0
+        ",
+        // 2. 开启分页模式
+        // satp = (8 << 60) | PPN(page_table)
+        "
+            la      t0, {page_table}
+            srli    t0, t0, 12
+            li      t1, 8 << 60
+            or      t0, t0, t1
+            csrw    satp, t0
+            sfence.vma
+        ", 
+        // 3. 跳到 secondary_entry
+        "
+            la      a2, {entry}
+            or      a2, a2, s0
+            mv      a0, s6
+            jalr    a2                      // call rust_main
+        ",
+        page_table = sym PAGE_TABLE,
+        entry = sym super::rust_secondary_main,
+        virt_addr_start = const VIRT_ADDR_START,
+        options(noreturn)
+    );
+}
+
+pub fn switch_to_kernel_page_table() {
+    unsafe {
+        riscv::register::satp::set(
+            riscv::register::satp::Mode::Sv39,
+            0,
+            (PAGE_TABLE.as_ptr() as usize & !VIRT_ADDR_START) >> 12,
+        );
+        sfence_vma_all();
+    }
+}
+
+pub fn kernel_page_table() -> PageTable {
+    PageTable(crate::addr::PhysAddr(unsafe {
+        PAGE_TABLE.as_ptr() as usize & !VIRT_ADDR_START
+    }))
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/interrupt.rs.html b/src/polyhal/riscv64/interrupt.rs.html new file mode 100644 index 0000000..c01755d --- /dev/null +++ b/src/polyhal/riscv64/interrupt.rs.html @@ -0,0 +1,643 @@ +interrupt.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+
use core::arch::{asm, global_asm};
+
+use riscv::register::{
+    scause::{self, Exception, Interrupt, Trap},
+    sie, stval, stvec,
+};
+
+use crate::{instruction::Instruction, TrapFrame, TrapType, VIRT_ADDR_START};
+
+use super::timer;
+
+global_asm!(
+    r"
+    .altmacro
+    .macro LOAD reg, offset
+        ld  \reg, \offset*8(sp)
+    .endm
+
+    .macro SAVE reg, offset
+        sd  \reg, \offset*8(sp)
+    .endm
+
+    .macro LOAD_N n
+        ld  x\n, \n*8(sp)
+    .endm
+
+    .macro SAVE_N n
+        sd  x\n, \n*8(sp)
+    .endm
+
+    .macro SAVE_GENERAL_REGS
+        SAVE    x1, 1
+        csrr    x1, sscratch
+        SAVE    x1, 2
+        .set    n, 3
+        .rept   29 
+            SAVE_N  %n
+        .set    n, n + 1
+        .endr
+
+        csrr    t0, sstatus
+        csrr    t1, sepc
+        SAVE    t0, 32
+        SAVE    t1, 33
+    .endm
+
+    .macro LOAD_GENERAL_REGS
+        LOAD    t0, 32
+        LOAD    t1, 33
+        csrw    sstatus, t0
+        csrw    sepc, t1
+
+        LOAD    x1, 1
+        .set    n, 3
+        .rept   29
+            LOAD_N  %n
+        .set    n, n + 1
+        .endr
+        LOAD    x2, 2
+    .endm
+
+    .macro LOAD_PERCPU dst, sym
+        lui  \dst, %hi(__PERCPU_\sym)
+        add  \dst, \dst, gp
+        ld   \dst, %lo(__PERCPU_\sym)(\dst)
+    .endm
+
+    .macro SAVE_PERCPU sym, temp, src
+        lui  \temp, %hi(__PERCPU_\sym)
+        add  \temp, \temp, gp
+        sd   \src,  %lo(__PERCPU_\sym)(\temp)
+    .endm
+"
+);
+
+#[no_mangle]
+#[percpu::def_percpu]
+static KERNEL_RSP: usize = 0;
+
+#[no_mangle]
+#[percpu::def_percpu]
+static USER_RSP: usize = 0;
+
+// 设置中断
+pub(crate) fn init_interrupt() {
+    crate::currrent_arch::page_table::sigtrx::init();
+    // 输出内核信息
+
+    unsafe {
+        stvec::write(kernelvec as usize, stvec::TrapMode::Direct);
+        // asm!("csrw stvec, a0", in("a0") kernelvec as usize);
+    }
+
+    // 初始化定时器
+    timer::init();
+}
+
+// 内核中断回调
+#[no_mangle]
+fn kernel_callback(context: &mut TrapFrame) -> TrapType {
+    let scause = scause::read();
+    let stval = stval::read();
+    // debug!(
+    //     "int occurs: {:#x} {:?}  stval {:#x}  sepc: {:#x}",
+    //     scause.bits(),
+    //     scause.cause(),
+    //     stval,
+    //     context.sepc
+    // );
+    let trap_type = match scause.cause() {
+        // 中断异常
+        Trap::Exception(Exception::Breakpoint) => {
+            context.sepc += 2;
+            TrapType::Breakpoint
+        }
+        Trap::Exception(Exception::LoadFault) => {
+            if stval > VIRT_ADDR_START {
+                panic!("kernel error: {:#x}", stval);
+            }
+            TrapType::Unknown
+        }
+        Trap::Exception(Exception::UserEnvCall) => TrapType::UserEnvCall,
+        // 时钟中断
+        Trap::Interrupt(Interrupt::SupervisorTimer) => {
+            timer::set_next_timeout();
+            TrapType::Time
+        }
+        Trap::Exception(Exception::StorePageFault) => TrapType::StorePageFault(stval),
+        Trap::Exception(Exception::InstructionPageFault) => TrapType::InstructionPageFault(stval),
+        Trap::Exception(Exception::IllegalInstruction) => TrapType::IllegalInstruction(stval),
+        Trap::Exception(Exception::LoadPageFault) => TrapType::LoadPageFault(stval),
+        Trap::Interrupt(Interrupt::SupervisorExternal) => TrapType::SupervisorExternal,
+        _ => {
+            error!(
+                "内核态中断发生: {:#x} {:?}  stval {:#x}  sepc: {:#x}",
+                scause.bits(),
+                scause.cause(),
+                stval,
+                context.sepc
+            );
+            panic!("未知中断: {:#x?}", context);
+        }
+    };
+    unsafe { crate::api::_interrupt_for_arch(context, trap_type) };
+    trap_type
+}
+
+#[naked]
+pub unsafe extern "C" fn kernelvec() {
+    asm!(
+        // 宏定义
+        r"
+            .align 4
+            .altmacro
+        
+            csrrw   sp, sscratch, sp
+            bnez    sp, uservec
+            csrr    sp, sscratch
+
+            addi    sp, sp, -{cx_size}
+            
+            SAVE_GENERAL_REGS
+            csrw    sscratch, x0
+
+            mv      a0, sp
+
+            call kernel_callback
+
+            LOAD_GENERAL_REGS
+            sret
+        ",
+        cx_size = const crate::consts::TRAPFRAME_SIZE,
+        options(noreturn)
+    )
+}
+
+#[naked]
+#[no_mangle]
+extern "C" fn user_restore(context: *mut TrapFrame) {
+    unsafe {
+        asm!(
+            r"
+                .align 4
+                .altmacro
+            ",
+            // 在内核态栈中开一个空间来存储内核态信息
+            // 下次发生中断必然会进入中断入口然后恢复这个上下文.
+            // 仅保存 Callee-saved regs、gp、tp、ra.
+            "   addi    sp, sp, -18*8
+                
+                sd      sp, 8*1(sp)
+                sd      gp, 8*2(sp)
+                sd      tp, 8*3(sp)
+                sd      s0, 8*4(sp)
+                sd      s1, 8*5(sp)
+                sd      s2, 8*6(sp)
+                sd      s3, 8*7(sp)
+                sd      s4, 8*8(sp)
+                sd      s5, 8*9(sp)
+                sd      s6, 8*10(sp)
+                sd      s7, 8*11(sp)
+                sd      s8, 8*12(sp)
+                sd      s9, 8*13(sp)
+                sd      s10, 8*14(sp)
+                sd      s11, 8*15(sp)
+                sd      a0,  8*16(sp)
+                sd      ra,  8*17(sp)
+            ",
+            // 将栈信息保存到用户栈.
+            // a0 是传入的Context, 然后下面会再次恢复 sp 地址.
+            "   sd      sp, 8*0(a0)
+                csrw    sscratch, a0
+                mv      sp, a0
+            
+                .short  0x2452      # fld  fs0, 272(sp)
+                .short  0x24f2      # fld  fs1, 280(sp)
+
+                LOAD_GENERAL_REGS
+                sret
+            ",
+            options(noreturn)
+        )
+    }
+}
+
+#[naked]
+#[no_mangle]
+#[allow(named_asm_labels)]
+pub unsafe extern "C" fn uservec() {
+    asm!(
+        r"
+        .altmacro
+    ",
+        // 保存 general registers, 除了 sp
+        "
+        SAVE_GENERAL_REGS
+        csrw    sscratch, x0
+
+        .word   0x10813827          # fsd fs0, 272(sp)
+        .word   0x10913c27          # fsd fs1, 280(sp)
+
+        mv      a0, sp
+        ld      sp, 0*8(a0)
+        sd      x0, 0*8(a0)
+    ",
+        // 恢复内核上下文信息, 仅恢复 callee-saved 寄存器和 ra、gp、tp
+        "  
+        ld      gp, 8*2(sp)
+        ld      tp, 8*3(sp)
+        ld      s0, 8*4(sp)
+        ld      s1, 8*5(sp)
+        ld      s2, 8*6(sp)
+        ld      s3, 8*7(sp)
+        ld      s4, 8*8(sp)
+        ld      s5, 8*9(sp)
+        ld      s6, 8*10(sp)
+        ld      s7, 8*11(sp)
+        ld      s8, 8*12(sp)
+        ld      s9, 8*13(sp)
+        ld      s10, 8*14(sp)
+        ld      s11, 8*15(sp)
+        ld      ra,  8*17(sp)
+        
+        ld      sp, 8(sp)
+    ",
+        // 回收栈
+        "   addi sp, sp, 18*8
+        ret
+    ",
+        options(noreturn)
+    );
+}
+
+/// Return Some(()) if it was interrupt by syscall, otherwise None.
+pub fn run_user_task(context: &mut TrapFrame) -> Option<()> {
+    user_restore(context);
+    match kernel_callback(context) {
+        TrapType::UserEnvCall => Some(()),
+        _ => None,
+    }
+}
+
+pub fn run_user_task_forever(context: &mut TrapFrame) -> ! {
+    loop {
+        user_restore(context);
+        kernel_callback(context);
+    }
+}
+
+#[allow(dead_code)]
+#[inline(always)]
+pub fn enable_irq() {
+    unsafe {
+        sie::set_sext();
+        sie::set_ssoft();
+    }
+}
+
+#[inline(always)]
+pub fn disable_irq() {
+    unsafe {
+        sie::clear_sext();
+        sie::clear_ssoft();
+    }
+}
+
+#[inline(always)]
+pub fn enable_external_irq() {
+    unsafe {
+        sie::set_sext();
+    }
+}
+
+impl Instruction {
+    #[inline]
+    pub fn ebreak() {
+        unsafe {
+            riscv::asm::ebreak();
+        }
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/kcontext.rs.html b/src/polyhal/riscv64/kcontext.rs.html new file mode 100644 index 0000000..85c86e5 --- /dev/null +++ b/src/polyhal/riscv64/kcontext.rs.html @@ -0,0 +1,413 @@ +kcontext.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+
use core::{
+    arch::asm,
+    ops::{Index, IndexMut},
+};
+
+use crate::{KContextArgs, PageTable};
+
+/// Kernel Context
+///
+/// Kernel Context is used to switch context between kernel task.
+#[derive(Debug)]
+#[repr(C)]
+pub struct KContext {
+    /// Kernel Stack Pointer
+    ksp: usize,
+    /// Kernel Thread Pointer
+    ktp: usize,
+    /// Kernel S regs, s0 - s11, just callee-saved registers
+    /// just used in the context_switch function.
+    _sregs: [usize; 12],
+    /// Kernel Program Counter, Will return to this address.
+    kpc: usize,
+}
+
+impl KContext {
+    /// Create a new blank Kernel Context.
+    pub fn blank() -> Self {
+        Self {
+            ksp: 0,
+            ktp: 0,
+            _sregs: [0; 12],
+            kpc: 0,
+        }
+    }
+}
+
+/// Indexing operations for KContext
+///
+/// Using it just like the Vector.
+///
+/// #[derive(Debug)]
+/// pub enum KContextArgs {
+///     /// Kernel Stack Pointer
+///     KSP,
+///     /// Kernel Thread Pointer
+///     KTP,
+///     /// Kernel Program Counter
+///     KPC
+/// }
+///
+/// etc. Get reg of the kernel stack:
+///
+/// let ksp = KContext[KContextArgs::KSP]
+/// let kpc = KContext[KContextArgs::KPC]
+/// let ktp = KContext[KContextArgs::KTP]
+///
+impl Index<KContextArgs> for KContext {
+    type Output = usize;
+
+    fn index(&self, index: KContextArgs) -> &Self::Output {
+        match index {
+            KContextArgs::KSP => &self.ksp,
+            KContextArgs::KTP => &self.ktp,
+            KContextArgs::KPC => &self.kpc,
+        }
+    }
+}
+
+/// Indexing Mutable operations for KContext
+///
+/// Using it just like the Vector.
+///
+/// etc. Change the value of the kernel Context using IndexMut
+///
+/// KContext[KContextArgs::KSP] = ksp;
+/// KContext[KContextArgs::KPC] = kpc;
+/// KContext[KContextArgs::KTP] = ktp;
+///
+impl IndexMut<KContextArgs> for KContext {
+    fn index_mut(&mut self, index: KContextArgs) -> &mut Self::Output {
+        match index {
+            KContextArgs::KSP => &mut self.ksp,
+            KContextArgs::KTP => &mut self.ktp,
+            KContextArgs::KPC => &mut self.kpc,
+        }
+    }
+}
+
+/// Context Switch
+///
+/// Save the context of current task and switch to new task.
+#[naked]
+pub unsafe extern "C" fn context_switch(from: *mut KContext, to: *const KContext) {
+    core::arch::asm!(
+        // Save Kernel Context.
+        "
+            sd      sp, 0*8(a0)
+            sd      tp, 1*8(a0)
+            sd      s0, 2*8(a0)
+            sd      s1, 3*8(a0)
+            sd      s2, 4*8(a0)
+            sd      s3, 5*8(a0)
+            sd      s4, 6*8(a0)
+            sd      s5, 7*8(a0)
+            sd      s6, 8*8(a0)
+            sd      s7, 9*8(a0)
+            sd      s8, 10*8(a0)
+            sd      s9, 11*8(a0)
+            sd      s10, 12*8(a0)
+            sd      s11, 13*8(a0)
+            sd      ra, 14*8(a0)
+        ",
+        // Restore Kernel Context.
+        "
+            ld      sp, 0*8(a1)
+            ld      tp, 1*8(a1)
+            ld      s0, 2*8(a1)
+            ld      s1, 3*8(a1)
+            ld      s2, 4*8(a1)
+            ld      s3, 5*8(a1)
+            ld      s4, 6*8(a1)
+            ld      s5, 7*8(a1)
+            ld      s6, 8*8(a1)
+            ld      s7, 9*8(a1)
+            ld      s8, 10*8(a1)
+            ld      s9, 11*8(a1)
+            ld      s10, 12*8(a1)
+            ld      s11, 13*8(a1)
+            ld      ra, 14*8(a1)
+            ret
+        ",
+        options(noreturn)
+    )
+}
+
+/// Context Switch With Page Table
+///
+/// Save the context of current task and switch to new task.
+#[naked]
+pub unsafe extern "C" fn context_switch_pt(
+    from: *mut KContext,
+    to: *const KContext,
+    pt_token: PageTable,
+) {
+    core::arch::asm!(
+        // Save Kernel Context.
+        "
+            sd      sp, 0*8(a0)
+            sd      tp, 1*8(a0)
+            sd      s0, 2*8(a0)
+            sd      s1, 3*8(a0)
+            sd      s2, 4*8(a0)
+            sd      s3, 5*8(a0)
+            sd      s4, 6*8(a0)
+            sd      s5, 7*8(a0)
+            sd      s6, 8*8(a0)
+            sd      s7, 9*8(a0)
+            sd      s8, 10*8(a0)
+            sd      s9, 11*8(a0)
+            sd      s10, 12*8(a0)
+            sd      s11, 13*8(a0)
+            sd      ra, 14*8(a0)
+        ",
+        // Switch to new page table.
+        "
+            srli    a2,   a2, 12
+            li      a3,   8 << 60
+            or      a2,   a2, a3
+            csrw    satp, a2
+            sfence.vma
+        ",
+        // Restore Kernel Context.
+        "
+            ld      sp, 0*8(a1)
+            ld      tp, 1*8(a1)
+            ld      s0, 2*8(a1)
+            ld      s1, 3*8(a1)
+            ld      s2, 4*8(a1)
+            ld      s3, 5*8(a1)
+            ld      s4, 6*8(a1)
+            ld      s5, 7*8(a1)
+            ld      s6, 8*8(a1)
+            ld      s7, 9*8(a1)
+            ld      s8, 10*8(a1)
+            ld      s9, 11*8(a1)
+            ld      s10, 12*8(a1)
+            ld      s11, 13*8(a1)
+            ld      ra, 14*8(a1)
+            ret
+        ",
+        options(noreturn)
+    )
+}
+
+#[naked]
+pub extern "C" fn read_current_tp() -> usize {
+    unsafe {
+        asm!(
+            "
+                mv      a0, tp
+                ret
+            ",
+            options(noreturn)
+        )
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/mod.rs.html b/src/polyhal/riscv64/mod.rs.html new file mode 100644 index 0000000..2fbf5e8 --- /dev/null +++ b/src/polyhal/riscv64/mod.rs.html @@ -0,0 +1,343 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+
mod barrier;
+mod boards;
+mod consts;
+mod context;
+mod entry;
+mod interrupt;
+#[cfg(feature = "kcontext")]
+mod kcontext;
+mod page_table;
+mod sbi;
+mod timer;
+
+use core::slice;
+
+use alloc::vec::Vec;
+pub use consts::*;
+pub use context::TrapFrame;
+pub use entry::{kernel_page_table, switch_to_kernel_page_table};
+use fdt::Fdt;
+pub use interrupt::{
+    disable_irq, enable_external_irq, enable_irq, run_user_task, run_user_task_forever,
+};
+use sbi::*;
+
+pub use sbi::shutdown;
+
+#[cfg(feature = "kcontext")]
+pub use kcontext::{context_switch, context_switch_pt, read_current_tp, KContext};
+
+use riscv::register::sstatus;
+
+use crate::{api::frame_alloc, multicore::MultiCore, once::LazyInit, CPU_NUM, DTB_BIN, MEM_AREA};
+
+#[percpu::def_percpu]
+static CPU_ID: usize = 0;
+
+static DTB_PTR: LazyInit<usize> = LazyInit::new();
+
+pub(crate) fn rust_main(hartid: usize, device_tree: usize) {
+    crate::clear_bss();
+    // Init allocator
+    percpu::init(4);
+    percpu::set_local_thread_pointer(hartid);
+    CPU_ID.write_current(hartid);
+
+    interrupt::init_interrupt();
+
+    let (_hartid, device_tree) = boards::init_device(hartid, device_tree | VIRT_ADDR_START);
+
+    // 开启 SUM
+    unsafe {
+        // 开启浮点运算
+        sstatus::set_fs(sstatus::FS::Dirty);
+    }
+
+    CPU_NUM.init_by(match unsafe { Fdt::from_ptr(device_tree as *const u8) } {
+        Ok(fdt) => fdt.cpus().count(),
+        Err(_) => 1,
+    });
+
+    DTB_PTR.init_by(device_tree);
+
+    unsafe { crate::api::_main_for_arch(hartid) };
+    shutdown();
+}
+
+pub(crate) extern "C" fn rust_secondary_main(hartid: usize) {
+    percpu::set_local_thread_pointer(hartid);
+    CPU_ID.write_current(hartid);
+
+    interrupt::init_interrupt();
+
+    let (hartid, _device_tree) = boards::init_device(hartid, 0);
+
+    unsafe {
+        // 开启浮点运算
+        sstatus::set_fs(sstatus::FS::Dirty);
+    }
+
+    info!("secondary hart {} started", hartid);
+    unsafe { crate::api::_main_for_arch(hartid) };
+    shutdown();
+}
+
+#[inline]
+pub fn wfi() {
+    unsafe {
+        riscv::register::sstatus::clear_sie();
+        riscv::asm::wfi();
+        riscv::register::sstatus::set_sie();
+    }
+}
+
+pub fn hart_id() -> usize {
+    CPU_ID.read_current()
+}
+
+pub fn arch_init() {
+    let mut buffer = Vec::new();
+    if let Ok(fdt) = unsafe { Fdt::from_ptr(*DTB_PTR as *const u8) } {
+        unsafe {
+            buffer.extend_from_slice(slice::from_raw_parts(
+                *DTB_PTR as *const u8,
+                fdt.total_size(),
+            ));
+        }
+    }
+    DTB_BIN.init_by(buffer);
+    let mut mem_area = Vec::new();
+    if let Ok(fdt) = Fdt::new(&DTB_BIN) {
+        info!("There has {} CPU(s)", fdt.cpus().count());
+        fdt.memory().regions().for_each(|x| {
+            info!(
+                "memory region {:#X} - {:#X}",
+                x.starting_address as usize,
+                x.starting_address as usize + x.size.unwrap()
+            );
+            mem_area.push((
+                x.starting_address as usize | VIRT_ADDR_START,
+                x.size.unwrap_or(0),
+            ));
+        });
+    } else {
+        mem_area.push((0x8000_0000 | VIRT_ADDR_START, 0x1000_0000));
+    }
+    MEM_AREA.init_by(mem_area);
+}
+
+#[cfg(feature = "multicore")]
+/// Implement the function for multicore
+impl MultiCore {
+    /// Boot all application cores.
+    pub fn boot_all() {
+        use self::entry::secondary_start;
+        use crate::{
+            addr::VirtPage,
+            pagetable::{MappingFlags, MappingSize, PageTable},
+        };
+
+        let page_table = PageTable::current();
+
+        (0..*CPU_NUM).into_iter().for_each(|cpu| {
+            if cpu == CPU_ID.read_current() {
+                return;
+            };
+
+            // PERCPU DATA ADDRESS RANGE END
+            let cpu_addr_end = MULTI_CORE_AREA + (cpu + 1) * MULTI_CORE_AREA_SIZE;
+            let aux_core_func = (secondary_start as usize) & (!VIRT_ADDR_START);
+
+            // Ready to build multi core area.
+            // default stack size is 512K
+            for i in 0..128 {
+                page_table.map_kernel(
+                    VirtPage::from_addr(cpu_addr_end - i * PageTable::PAGE_SIZE - 1),
+                    frame_alloc(),
+                    MappingFlags::RWX | MappingFlags::G,
+                    MappingSize::Page4KB,
+                )
+            }
+
+            info!("secondary addr: {:#x}", secondary_start as usize);
+            let ret = sbi_rt::hart_start(cpu, aux_core_func, cpu_addr_end);
+            if ret.is_ok() {
+                info!("hart {} Startting successfully", cpu);
+            } else {
+                warn!("hart {} Startting failed", cpu)
+            }
+        });
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/page_table/mod.rs.html b/src/polyhal/riscv64/page_table/mod.rs.html new file mode 100644 index 0000000..68f1e3a --- /dev/null +++ b/src/polyhal/riscv64/page_table/mod.rs.html @@ -0,0 +1,67 @@ +mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+
pub mod sigtrx;
+mod sv39;
+
+use core::arch::riscv64::sfence_vma;
+
+pub use sv39::*;
+
+use crate::addr::VirtAddr;
+use crate::pagetable::TLB;
+
+/// TLB operations
+impl TLB {
+    /// flush the TLB entry by VirtualAddress
+    /// just use it directly
+    ///
+    /// TLB::flush_vaddr(arg0); // arg0 is the virtual address(VirtAddr)
+    #[inline]
+    pub fn flush_vaddr(vaddr: VirtAddr) {
+        unsafe {
+            sfence_vma(vaddr.0, 0);
+        }
+    }
+
+    /// flush all tlb entry
+    ///
+    /// how to use ?
+    /// just
+    /// TLB::flush_all();
+    #[inline]
+    pub fn flush_all() {
+        riscv::asm::sfence_vma_all();
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/page_table/sigtrx.rs.html b/src/polyhal/riscv64/page_table/sigtrx.rs.html new file mode 100644 index 0000000..d234558 --- /dev/null +++ b/src/polyhal/riscv64/page_table/sigtrx.rs.html @@ -0,0 +1,89 @@ +sigtrx.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+
use crate::{
+    pagetable::{PageTable, PTE},
+    VIRT_ADDR_START,
+};
+
+use super::PTEFlags;
+
+/// 汇编入口函数
+///
+/// 分配栈 初始化页表信息 并调到rust入口函数
+#[naked]
+#[no_mangle]
+#[link_section = ".sigtrx.sigreturn"]
+unsafe extern "C" fn _sigreturn() -> ! {
+    core::arch::asm!(
+        // 1. 设置栈信息
+        // sp = bootstack + (hartid + 1) * 0x10000
+        "
+            li  a7, 139
+            ecall
+        ",
+        options(noreturn)
+    )
+}
+
+#[link_section = ".data.prepage.trx1"]
+static mut TRX_STEP1: [PTE; PageTable::PTE_NUM_IN_PAGE] = [PTE(0); PageTable::PTE_NUM_IN_PAGE];
+
+#[link_section = ".data.prepage.trx2"]
+static mut TRX_STEP2: [PTE; PageTable::PTE_NUM_IN_PAGE] = [PTE(0); PageTable::PTE_NUM_IN_PAGE];
+
+pub fn init() {
+    unsafe {
+        TRX_STEP1[0] = PTE::from_addr(
+            _sigreturn as usize & !VIRT_ADDR_START,
+            PTEFlags::ADUVRX.union(PTEFlags::G),
+        );
+        TRX_STEP2[0] = PTE::from_addr(TRX_STEP1.as_ptr() as usize & !VIRT_ADDR_START, PTEFlags::V);
+    }
+}
+
+pub fn get_trx_mapping() -> usize {
+    unsafe { TRX_STEP2.as_ptr() as usize & !VIRT_ADDR_START }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/page_table/sv39.rs.html b/src/polyhal/riscv64/page_table/sv39.rs.html new file mode 100644 index 0000000..4ca1756 --- /dev/null +++ b/src/polyhal/riscv64/page_table/sv39.rs.html @@ -0,0 +1,459 @@ +sv39.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+
use bitflags::bitflags;
+use riscv::register::satp;
+
+use crate::addr::{PhysAddr, PhysPage, VirtAddr, VirtPage};
+use crate::kernel_page_table;
+use crate::pagetable::MappingFlags;
+use crate::pagetable::{PageTable, PTE, TLB};
+
+use super::sigtrx::get_trx_mapping;
+
+impl PTE {
+    #[inline]
+    pub const fn from_ppn(ppn: usize, flags: PTEFlags) -> Self {
+        // let flags = flags.union(PTEFlags::D);
+        let mut flags = flags;
+        if flags.contains(PTEFlags::R) | flags.contains(PTEFlags::X) {
+            flags = flags.union(PTEFlags::A)
+        }
+        if flags.contains(PTEFlags::W) {
+            flags = flags.union(PTEFlags::D)
+        }
+        // TIPS: This is prepare for the extend bits of T-HEAD C906
+        #[cfg(c906)]
+        if flags.contains(PTEFlags::G) && ppn == 0x8_0000 {
+            Self(
+                ppn << 10
+                    | flags
+                        .union(PTEFlags::C)
+                        .union(PTEFlags::B)
+                        .union(PTEFlags::K)
+                        .bits() as usize,
+            )
+        } else if flags.contains(PTEFlags::G) && ppn == 0 {
+            Self(ppn << 10 | flags.union(PTEFlags::SE).union(PTEFlags::SO).bits() as usize)
+        } else {
+            Self(ppn << 10 | flags.union(PTEFlags::C).bits() as usize)
+        }
+
+        #[cfg(not(c906))]
+        Self(ppn << 10 | flags.bits() as usize)
+    }
+
+    #[inline]
+    pub const fn from_addr(addr: usize, flags: PTEFlags) -> Self {
+        Self::from_ppn(addr >> 12, flags)
+    }
+
+    #[inline]
+    pub const fn flags(&self) -> PTEFlags {
+        PTEFlags::from_bits_truncate((self.0 & 0xff) as u64)
+    }
+
+    #[inline]
+    pub const fn is_valid(&self) -> bool {
+        self.flags().contains(PTEFlags::V) && self.0 > u8::MAX as usize
+    }
+
+    /// 判断是否是大页
+    ///
+    /// 大页判断条件 V 位为 1, R/W/X 位至少有一个不为 0
+    /// PTE 页表范围 1G(0x4000_0000) 2M(0x20_0000) 4K(0x1000)
+    #[inline]
+    pub fn is_huge(&self) -> bool {
+        return self.flags().contains(PTEFlags::V)
+            && (self.flags().contains(PTEFlags::R)
+                || self.flags().contains(PTEFlags::W)
+                || self.flags().contains(PTEFlags::X));
+    }
+
+    #[inline]
+    pub(crate) fn is_table(&self) -> bool {
+        return self.flags().contains(PTEFlags::V)
+            && !(self.flags().contains(PTEFlags::R)
+                || self.flags().contains(PTEFlags::W)
+                || self.flags().contains(PTEFlags::X));
+    }
+
+    #[inline]
+    pub(crate) fn new_table(ppn: PhysPage) -> Self {
+        Self((ppn.0 << 10) | (PTEFlags::V).bits() as usize)
+    }
+
+    #[inline]
+    pub(crate) fn new_page(ppn: PhysPage, flags: PTEFlags) -> Self {
+        Self((ppn.0 << 10) | flags.bits() as usize)
+    }
+
+    #[inline]
+    pub(crate) fn address(&self) -> PhysAddr {
+        PhysAddr((self.0 << 2) & 0xFFFF_FFFF_F000)
+    }
+}
+
+bitflags! {
+    #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+    pub struct PTEFlags: u64 {
+        const V = bit!(0);
+        const R = bit!(1);
+        const W = bit!(2);
+        const X = bit!(3);
+        const U = bit!(4);
+        const G = bit!(5);
+        const A = bit!(6);
+        const D = bit!(7);
+
+        #[cfg(c906)]
+        const SO = bit!(63);
+        #[cfg(c906)]
+        const C = bit!(62);
+        #[cfg(c906)]
+        const B = bit!(61);
+        #[cfg(c906)]
+        const K = bit!(60);
+        #[cfg(c906)]
+        const SE = bit!(59);
+
+        const VRWX  = Self::V.bits() | Self::R.bits() | Self::W.bits() | Self::X.bits();
+        const ADUVRX = Self::A.bits() | Self::D.bits() | Self::U.bits() | Self::V.bits() | Self::R.bits() | Self::X.bits();
+        const ADVRWX = Self::A.bits() | Self::D.bits() | Self::VRWX.bits();
+        const ADGVRWX = Self::G.bits() | Self::ADVRWX.bits();
+    }
+}
+
+impl From<MappingFlags> for PTEFlags {
+    fn from(flags: MappingFlags) -> Self {
+        if flags.is_empty() {
+            Self::empty()
+        } else {
+            let mut res = Self::V;
+            if flags.contains(MappingFlags::R) {
+                res |= PTEFlags::R | PTEFlags::A;
+            }
+            if flags.contains(MappingFlags::W) {
+                res |= PTEFlags::W | PTEFlags::D;
+            }
+            if flags.contains(MappingFlags::X) {
+                res |= PTEFlags::X;
+            }
+            if flags.contains(MappingFlags::U) {
+                res |= PTEFlags::U;
+            }
+            res
+        }
+    }
+}
+
+impl From<PTEFlags> for MappingFlags {
+    fn from(value: PTEFlags) -> Self {
+        let mut mapping_flags = MappingFlags::empty();
+        if value.contains(PTEFlags::V) {
+            mapping_flags |= MappingFlags::P;
+        }
+        if value.contains(PTEFlags::R) {
+            mapping_flags |= MappingFlags::R;
+        }
+        if value.contains(PTEFlags::W) {
+            mapping_flags |= MappingFlags::W;
+        }
+        if value.contains(PTEFlags::X) {
+            mapping_flags |= MappingFlags::X;
+        }
+        if value.contains(PTEFlags::U) {
+            mapping_flags |= MappingFlags::U;
+        }
+        if value.contains(PTEFlags::A) {
+            mapping_flags |= MappingFlags::A;
+        }
+        if value.contains(PTEFlags::D) {
+            mapping_flags |= MappingFlags::D;
+        }
+
+        mapping_flags
+    }
+}
+
+impl PageTable {
+    /// The size of the page for this platform.
+    pub(crate) const PAGE_SIZE: usize = 0x1000;
+    pub(crate) const PAGE_LEVEL: usize = 3;
+    pub(crate) const PTE_NUM_IN_PAGE: usize = 0x200;
+    pub(crate) const GLOBAL_ROOT_PTE_RANGE: usize = 0x100;
+    pub(crate) const VADDR_BITS: usize = 39;
+    pub(crate) const USER_VADDR_END: usize = (1 << Self::VADDR_BITS) - 1;
+    pub(crate) const KERNEL_VADDR_START: usize = !Self::USER_VADDR_END;
+
+    #[inline]
+    pub fn current() -> Self {
+        Self(PhysAddr(satp::read().ppn() << 12))
+    }
+
+    #[inline]
+    pub fn kernel_pte_entry(&self) -> PhysAddr {
+        self.0
+    }
+
+    #[inline]
+    pub fn restore(&self) {
+        self.release();
+        let kernel_arr = Self::get_pte_list(kernel_page_table().0);
+        let arr = Self::get_pte_list(self.0);
+        arr[0x100..].copy_from_slice(&kernel_arr[0x100..]);
+        // TODO: using map kernel in the boot instead of map here manually
+        arr[0x104] = PTE::from_addr(get_trx_mapping(), PTEFlags::V);
+        arr[0..0x100].fill(PTE(0));
+    }
+
+    #[inline]
+    pub fn change(&self) {
+        // Write page table entry for
+        satp::write((8 << 60) | (self.0 .0 >> 12));
+        TLB::flush_all();
+    }
+}
+
+impl VirtPage {
+    /// Get n level page table index of the given virtual address
+    #[inline]
+    pub fn pn_index(&self, n: usize) -> usize {
+        (self.0 >> 9 * n) & 0x1ff
+    }
+}
+
+impl VirtAddr {
+    /// Get n level page table offset of the given virtual address
+    #[inline]
+    pub fn pn_offest(&self, n: usize) -> usize {
+        self.0 % (1 << (12 + 9 * n))
+    }
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/sbi.rs.html b/src/polyhal/riscv64/sbi.rs.html new file mode 100644 index 0000000..57a4bb1 --- /dev/null +++ b/src/polyhal/riscv64/sbi.rs.html @@ -0,0 +1,129 @@ +sbi.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+
//! 调用 Machine 层的操作
+// 目前还不会用到全部的 SBI 调用,暂时允许未使用的变量或函数
+#![allow(unused)]
+
+use core::arch::asm;
+
+use sbi_rt::{NoReason, Shutdown};
+
+use crate::debug::DebugConsole;
+
+const SBI_SET_TIMER: usize = 0;
+const SBI_CONSOLE_PUT_CHAR: usize = 1;
+const SBI_CONSOLE_GET_CHAR: usize = 2;
+const SBI_CLEAR_IPI: usize = 3;
+const SBI_SEND_IPI: usize = 4;
+const SBI_REMOTE_FENCE_I: usize = 5;
+const SBI_REMOTE_SFENCE_VMA: usize = 6;
+const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
+const SBI_SHUTDOWN: usize = 8;
+
+// SBI 调用
+fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
+    let mut ret;
+    unsafe {
+        asm!("ecall",
+        in("a7") which,
+        inlateout("a0") arg0 => ret,
+        in("a1") arg1,
+        in("a2") arg2);
+    }
+    ret
+}
+
+/// 设置定时器
+#[inline]
+pub fn set_timer(time: usize) {
+    sbi_rt::set_timer(time as _);
+}
+
+impl DebugConsole {
+    #[inline]
+    #[allow(deprecated)]
+    pub fn putchar(ch: u8) {
+        sbi_rt::legacy::console_putchar(ch as _);
+    }
+
+    #[inline]
+    #[allow(deprecated)]
+    pub fn getchar() -> Option<u8> {
+        let c = sbi_rt::legacy::console_getchar() as u8;
+        match c == u8::MAX {
+            true => None,
+            _ => Some(c),
+        }
+    }
+}
+
+/// 调用 SBI_SHUTDOWN 来关闭操作系统(直接退出 QEMU)
+#[inline]
+pub fn shutdown() -> ! {
+    // sbi_rt::legacy::shutdown();
+    sbi_rt::system_reset(Shutdown, NoReason);
+    unreachable!()
+}
+
\ No newline at end of file diff --git a/src/polyhal/riscv64/timer.rs.html b/src/polyhal/riscv64/timer.rs.html new file mode 100644 index 0000000..4a9dbce --- /dev/null +++ b/src/polyhal/riscv64/timer.rs.html @@ -0,0 +1,65 @@ +timer.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+
use crate::currrent_arch::boards::CLOCK_FREQ;
+use crate::time::Time;
+use riscv::register::{sie, time};
+
+use super::set_timer;
+
+impl Time {
+    #[inline]
+    pub fn get_freq() -> usize {
+        CLOCK_FREQ
+    }
+
+    #[inline]
+    pub fn now() -> Self {
+        Self(time::read())
+    }
+}
+
+// 设置下一次时钟中断触发时间
+#[inline]
+pub fn set_next_timeout() {
+    // 调用sbi设置定时器
+    set_timer(time::read() + CLOCK_FREQ / 100);
+}
+
+pub fn init() {
+    unsafe {
+        sie::set_stimer();
+    }
+    set_next_timeout();
+    info!("initialize timer interrupt");
+}
+
\ No newline at end of file diff --git a/src/polyhal/time.rs.html b/src/polyhal/time.rs.html new file mode 100644 index 0000000..2534137 --- /dev/null +++ b/src/polyhal/time.rs.html @@ -0,0 +1,141 @@ +time.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+
/// Time struct and its interface
+///
+/// You can use this to get time from ticks
+///
+/// ### get current time
+/// ```rust
+/// Time::now();
+/// ```
+///
+/// ### get current cpu's frequency
+/// ```rust
+/// Time::get_freq();
+/// ```
+///
+/// ### get how many nanoseconds have passed.
+/// ```rust
+/// Time::now().to_nsec();
+/// ```
+///
+/// ### get how many microseconds have passed.
+/// ```rust
+/// Time::now().to_usec();
+/// ```
+///
+/// ### get how many millisecond have passed.
+/// ```rust
+/// Time::now().to_msec();
+/// ```
+///
+/// ### get how may ticks have passed
+/// ```rust
+/// Time::now().raw();
+/// ```
+///
+/// ### convert ticks to time
+/// ```rust
+/// Time::from_raw(Time::now().raw());
+/// ```
+///
+
+#[derive(Clone, Copy, Debug)]
+pub struct Time(pub(crate) usize);
+
+impl Time {
+    #[inline]
+    pub fn to_msec(&self) -> usize {
+        self.0 * 1_000 / Self::get_freq()
+    }
+
+    #[inline]
+    pub fn to_usec(&self) -> usize {
+        self.0 * 1000_000 / Self::get_freq()
+    }
+
+    /// Converts hardware ticks to nanoseconds.
+    #[inline]
+    pub fn to_nsec(&self) -> usize {
+        self.0 * 1000_000_000 / Self::get_freq()
+    }
+
+    #[inline]
+    pub fn raw(&self) -> usize {
+        self.0
+    }
+
+    #[inline]
+    pub fn from_raw(raw: usize) -> Self {
+        Self(raw)
+    }
+}
+
\ No newline at end of file diff --git a/static.files/COPYRIGHT-23e9bde6c69aea69.txt b/static.files/COPYRIGHT-23e9bde6c69aea69.txt new file mode 100644 index 0000000..1447df7 --- /dev/null +++ b/static.files/COPYRIGHT-23e9bde6c69aea69.txt @@ -0,0 +1,50 @@ +# REUSE-IgnoreStart + +These documentation pages include resources by third parties. This copyright +file applies only to those resources. The following third party resources are +included, and carry their own copyright notices and license terms: + +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): + + Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ + with Reserved Font Name Fira Sans. + + Copyright (c) 2014, Telefonica S.A. + + Licensed under the SIL Open Font License, Version 1.1. + See FiraSans-LICENSE.txt. + +* rustdoc.css, main.js, and playpen.js: + + Copyright 2015 The Rust Developers. + Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or + the MIT license (LICENSE-MIT.txt) at your option. + +* normalize.css: + + Copyright (c) Nicolas Gallagher and Jonathan Neal. + Licensed under the MIT license (see LICENSE-MIT.txt). + +* Source Code Pro (SourceCodePro-Regular.ttf.woff2, + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): + + Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark + of Adobe Systems Incorporated in the United States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceCodePro-LICENSE.txt. + +* Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, + SourceSerif4-It.ttf.woff2): + + Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name + 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United + States and/or other countries. + + Licensed under the SIL Open Font License, Version 1.1. + See SourceSerif4-LICENSE.md. + +This copyright file is intended to be distributed with rustdoc output. + +# REUSE-IgnoreEnd diff --git a/static.files/FiraSans-LICENSE-db4b642586e02d97.txt b/static.files/FiraSans-LICENSE-db4b642586e02d97.txt new file mode 100644 index 0000000..d7e9c14 --- /dev/null +++ b/static.files/FiraSans-LICENSE-db4b642586e02d97.txt @@ -0,0 +1,98 @@ +// REUSE-IgnoreStart + +Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A. +with Reserved Font Name < Fira >, + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 b/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 new file mode 100644 index 0000000..7a1e5fc Binary files /dev/null and b/static.files/FiraSans-Medium-8f9a781e4970d388.woff2 differ diff --git a/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 b/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 new file mode 100644 index 0000000..e766e06 Binary files /dev/null and b/static.files/FiraSans-Regular-018c141bf0843ffd.woff2 differ diff --git a/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt b/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/static.files/LICENSE-APACHE-b91fa81cba47b86a.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/static.files/LICENSE-MIT-65090b722b3f6c56.txt b/static.files/LICENSE-MIT-65090b722b3f6c56.txt new file mode 100644 index 0000000..31aa793 --- /dev/null +++ b/static.files/LICENSE-MIT-65090b722b3f6c56.txt @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 b/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 new file mode 100644 index 0000000..1866ad4 Binary files /dev/null and b/static.files/NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2 differ diff --git a/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt b/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt new file mode 100644 index 0000000..4b3edc2 --- /dev/null +++ b/static.files/NanumBarunGothic-LICENSE-18c5adf4b52b4041.txt @@ -0,0 +1,103 @@ +// REUSE-IgnoreStart + +Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/), + +with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, +NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, +Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, +NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, +Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen, MaruBuri + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 b/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 new file mode 100644 index 0000000..462c34e Binary files /dev/null and b/static.files/SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2 differ diff --git a/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt b/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt new file mode 100644 index 0000000..0d2941e --- /dev/null +++ b/static.files/SourceCodePro-LICENSE-d180d465a756484a.txt @@ -0,0 +1,97 @@ +// REUSE-IgnoreStart + +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +// REUSE-IgnoreEnd diff --git a/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 b/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 new file mode 100644 index 0000000..10b558e Binary files /dev/null and b/static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2 differ diff --git a/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 b/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 new file mode 100644 index 0000000..5ec64ee Binary files /dev/null and b/static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2 differ diff --git a/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 b/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 new file mode 100644 index 0000000..181a07f Binary files /dev/null and b/static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2 differ diff --git a/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 b/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 new file mode 100644 index 0000000..2ae08a7 Binary files /dev/null and b/static.files/SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2 differ diff --git a/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md b/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md new file mode 100644 index 0000000..175fa4f --- /dev/null +++ b/static.files/SourceSerif4-LICENSE-3bb119e13b1258b7.md @@ -0,0 +1,98 @@ + + +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. +Copyright 2014 - 2023 Adobe (http://www.adobe.com/), with Reserved Font Name ‘Source’. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + + diff --git a/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 b/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 new file mode 100644 index 0000000..0263fc3 Binary files /dev/null and b/static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2 differ diff --git a/static.files/clipboard-7571035ce49a181d.svg b/static.files/clipboard-7571035ce49a181d.svg new file mode 100644 index 0000000..8adbd99 --- /dev/null +++ b/static.files/clipboard-7571035ce49a181d.svg @@ -0,0 +1 @@ + diff --git a/static.files/favicon-16x16-8b506e7a72182f1c.png b/static.files/favicon-16x16-8b506e7a72182f1c.png new file mode 100644 index 0000000..ea4b45c Binary files /dev/null and b/static.files/favicon-16x16-8b506e7a72182f1c.png differ diff --git a/static.files/favicon-2c020d218678b618.svg b/static.files/favicon-2c020d218678b618.svg new file mode 100644 index 0000000..8b34b51 --- /dev/null +++ b/static.files/favicon-2c020d218678b618.svg @@ -0,0 +1,24 @@ + + + + + diff --git a/static.files/favicon-32x32-422f7d1d52889060.png b/static.files/favicon-32x32-422f7d1d52889060.png new file mode 100644 index 0000000..69b8613 Binary files /dev/null and b/static.files/favicon-32x32-422f7d1d52889060.png differ diff --git a/static.files/main-77dede896d6ac08e.js b/static.files/main-77dede896d6ac08e.js new file mode 100644 index 0000000..d511f28 --- /dev/null +++ b/static.files/main-77dede896d6ac08e.js @@ -0,0 +1,11 @@ +"use strict";window.RUSTDOC_TOOLTIP_HOVER_MS=300;window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS=450;function resourcePath(basename,extension){return getVar("root-path")+basename+getVar("resource-suffix")+extension}function hideMain(){addClass(document.getElementById(MAIN_ID),"hidden")}function showMain(){removeClass(document.getElementById(MAIN_ID),"hidden")}function blurHandler(event,parentElem,hideCallback){if(!parentElem.contains(document.activeElement)&&!parentElem.contains(event.relatedTarget)){hideCallback()}}window.rootPath=getVar("root-path");window.currentCrate=getVar("current-crate");function setMobileTopbar(){const mobileTopbar=document.querySelector(".mobile-topbar");const locationTitle=document.querySelector(".sidebar h2.location");if(mobileTopbar){const mobileTitle=document.createElement("h2");mobileTitle.className="location";if(hasClass(document.querySelector(".rustdoc"),"crate")){mobileTitle.innerText=`Crate ${window.currentCrate}`}else if(locationTitle){mobileTitle.innerHTML=locationTitle.innerHTML}mobileTopbar.appendChild(mobileTitle)}}function getVirtualKey(ev){if("key"in ev&&typeof ev.key!=="undefined"){return ev.key}const c=ev.charCode||ev.keyCode;if(c===27){return"Escape"}return String.fromCharCode(c)}const MAIN_ID="main-content";const SETTINGS_BUTTON_ID="settings-menu";const ALTERNATIVE_DISPLAY_ID="alternative-display";const NOT_DISPLAYED_ID="not-displayed";const HELP_BUTTON_ID="help-button";function getSettingsButton(){return document.getElementById(SETTINGS_BUTTON_ID)}function getHelpButton(){return document.getElementById(HELP_BUTTON_ID)}function getNakedUrl(){return window.location.href.split("?")[0].split("#")[0]}function insertAfter(newNode,referenceNode){referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)}function getOrCreateSection(id,classes){let el=document.getElementById(id);if(!el){el=document.createElement("section");el.id=id;el.className=classes;insertAfter(el,document.getElementById(MAIN_ID))}return el}function getAlternativeDisplayElem(){return getOrCreateSection(ALTERNATIVE_DISPLAY_ID,"content hidden")}function getNotDisplayedElem(){return getOrCreateSection(NOT_DISPLAYED_ID,"hidden")}function switchDisplayedElement(elemToDisplay){const el=getAlternativeDisplayElem();if(el.children.length>0){getNotDisplayedElem().appendChild(el.firstElementChild)}if(elemToDisplay===null){addClass(el,"hidden");showMain();return}el.appendChild(elemToDisplay);hideMain();removeClass(el,"hidden")}function browserSupportsHistoryApi(){return window.history&&typeof window.history.pushState==="function"}function preLoadCss(cssUrl){const link=document.createElement("link");link.href=cssUrl;link.rel="preload";link.as="style";document.getElementsByTagName("head")[0].appendChild(link)}(function(){const isHelpPage=window.location.pathname.endsWith("/help.html");function loadScript(url){const script=document.createElement("script");script.src=url;document.head.append(script)}getSettingsButton().onclick=event=>{if(event.ctrlKey||event.altKey||event.metaKey){return}window.hideAllModals(false);addClass(getSettingsButton(),"rotate");event.preventDefault();loadScript(getVar("static-root-path")+getVar("settings-js"));setTimeout(()=>{const themes=getVar("themes").split(",");for(const theme of themes){if(theme!==""){preLoadCss(getVar("root-path")+theme+".css")}}},0)};window.searchState={loadingText:"Loading search results...",input:document.getElementsByClassName("search-input")[0],outputElement:()=>{let el=document.getElementById("search");if(!el){el=document.createElement("section");el.id="search";getNotDisplayedElem().appendChild(el)}return el},title:document.title,titleBeforeSearch:document.title,timeout:null,currentTab:0,focusedByTab:[null,null,null],clearInputTimeout:()=>{if(searchState.timeout!==null){clearTimeout(searchState.timeout);searchState.timeout=null}},isDisplayed:()=>searchState.outputElement().parentElement.id===ALTERNATIVE_DISPLAY_ID,focus:()=>{searchState.input.focus()},defocus:()=>{searchState.input.blur()},showResults:search=>{if(search===null||typeof search==="undefined"){search=searchState.outputElement()}switchDisplayedElement(search);searchState.mouseMovedAfterSearch=false;document.title=searchState.title},removeQueryParameters:()=>{document.title=searchState.titleBeforeSearch;if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.hash)}},hideResults:()=>{switchDisplayedElement(null);searchState.removeQueryParameters()},getQueryStringParams:()=>{const params={};window.location.search.substring(1).split("&").map(s=>{const pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1])});return params},setup:()=>{const search_input=searchState.input;if(!searchState.input){return}let searchLoaded=false;function loadSearch(){if(!searchLoaded){searchLoaded=true;loadScript(getVar("static-root-path")+getVar("search-js"));loadScript(resourcePath("search-index",".js"))}}search_input.addEventListener("focus",()=>{search_input.origPlaceholder=search_input.placeholder;search_input.placeholder="Type your search here.";loadSearch()});if(search_input.value!==""){loadSearch()}const params=searchState.getQueryStringParams();if(params.search!==undefined){searchState.setLoadingSearch();loadSearch()}},setLoadingSearch:()=>{const search=searchState.outputElement();search.innerHTML="

"+searchState.loadingText+"

";searchState.showResults(search)},};const toggleAllDocsId="toggle-all-docs";let savedHash="";function handleHashes(ev){if(ev!==null&&searchState.isDisplayed()&&ev.newURL){switchDisplayedElement(null);const hash=ev.newURL.slice(ev.newURL.indexOf("#")+1);if(browserSupportsHistoryApi()){history.replaceState(null,"",getNakedUrl()+window.location.search+"#"+hash)}const elem=document.getElementById(hash);if(elem){elem.scrollIntoView()}}const pageId=window.location.hash.replace(/^#/,"");if(savedHash!==pageId){savedHash=pageId;if(pageId!==""){expandSection(pageId)}}if(savedHash.startsWith("impl-")){const splitAt=savedHash.indexOf("/");if(splitAt!==-1){const implId=savedHash.slice(0,splitAt);const assocId=savedHash.slice(splitAt+1);const implElem=document.getElementById(implId);if(implElem&&implElem.parentElement.tagName==="SUMMARY"&&implElem.parentElement.parentElement.tagName==="DETAILS"){onEachLazy(implElem.parentElement.parentElement.querySelectorAll(`[id^="${assocId}"]`),item=>{const numbered=/([^-]+)-([0-9]+)/.exec(item.id);if(item.id===assocId||(numbered&&numbered[1]===assocId)){openParentDetails(item);item.scrollIntoView();setTimeout(()=>{window.location.replace("#"+item.id)},0)}})}}}}function onHashChange(ev){hideSidebar();handleHashes(ev)}function openParentDetails(elem){while(elem){if(elem.tagName==="DETAILS"){elem.open=true}elem=elem.parentNode}}function expandSection(id){openParentDetails(document.getElementById(id))}function handleEscape(ev){searchState.clearInputTimeout();searchState.hideResults();ev.preventDefault();searchState.defocus();window.hideAllModals(true)}function handleShortcut(ev){const disableShortcuts=getSettingValue("disable-shortcuts")==="true";if(ev.ctrlKey||ev.altKey||ev.metaKey||disableShortcuts){return}if(document.activeElement.tagName==="INPUT"&&document.activeElement.type!=="checkbox"&&document.activeElement.type!=="radio"){switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break}}else{switch(getVirtualKey(ev)){case"Escape":handleEscape(ev);break;case"s":case"S":ev.preventDefault();searchState.focus();break;case"+":ev.preventDefault();expandAllDocs();break;case"-":ev.preventDefault();collapseAllDocs();break;case"?":showHelp();break;default:break}}}document.addEventListener("keypress",handleShortcut);document.addEventListener("keydown",handleShortcut);function addSidebarItems(){if(!window.SIDEBAR_ITEMS){return}const sidebar=document.getElementsByClassName("sidebar-elems")[0];function block(shortty,id,longty){const filtered=window.SIDEBAR_ITEMS[shortty];if(!filtered){return}const modpath=hasClass(document.querySelector(".rustdoc"),"mod")?"../":"";const h3=document.createElement("h3");h3.innerHTML=`${longty}`;const ul=document.createElement("ul");ul.className="block "+shortty;for(const name of filtered){let path;if(shortty==="mod"){path=`${modpath}${name}/index.html`}else{path=`${modpath}${shortty}.${name}.html`}let current_page=document.location.href.toString();if(current_page.endsWith("/")){current_page+="index.html"}const link=document.createElement("a");link.href=path;if(link.href===current_page){link.className="current"}link.textContent=name;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebar.appendChild(h3);sidebar.appendChild(ul)}if(sidebar){block("primitive","primitives","Primitive Types");block("mod","modules","Modules");block("macro","macros","Macros");block("struct","structs","Structs");block("enum","enums","Enums");block("constant","constants","Constants");block("static","static","Statics");block("trait","traits","Traits");block("fn","functions","Functions");block("type","types","Type Aliases");block("union","unions","Unions");block("foreigntype","foreign-types","Foreign Types");block("keyword","keywords","Keywords");block("opaque","opaque-types","Opaque Types");block("attr","attributes","Attribute Macros");block("derive","derives","Derive Macros");block("traitalias","trait-aliases","Trait Aliases")}}window.register_implementors=imp=>{const implementors=document.getElementById("implementors-list");const synthetic_implementors=document.getElementById("synthetic-implementors-list");const inlined_types=new Set();const TEXT_IDX=0;const SYNTHETIC_IDX=1;const TYPES_IDX=2;if(synthetic_implementors){onEachLazy(synthetic_implementors.getElementsByClassName("impl"),el=>{const aliases=el.getAttribute("data-aliases");if(!aliases){return}aliases.split(",").forEach(alias=>{inlined_types.add(alias)})})}let currentNbImpls=implementors.getElementsByClassName("impl").length;const traitName=document.querySelector(".main-heading h1 > .trait").textContent;const baseIdName="impl-"+traitName+"-";const libs=Object.getOwnPropertyNames(imp);const script=document.querySelector("script[data-ignore-extern-crates]");const ignoreExternCrates=new Set((script?script.getAttribute("data-ignore-extern-crates"):"").split(","));for(const lib of libs){if(lib===window.currentCrate||ignoreExternCrates.has(lib)){continue}const structs=imp[lib];struct_loop:for(const struct of structs){const list=struct[SYNTHETIC_IDX]?synthetic_implementors:implementors;if(struct[SYNTHETIC_IDX]){for(const struct_type of struct[TYPES_IDX]){if(inlined_types.has(struct_type)){continue struct_loop}inlined_types.add(struct_type)}}const code=document.createElement("h3");code.innerHTML=struct[TEXT_IDX];addClass(code,"code-header");onEachLazy(code.getElementsByTagName("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});const currentId=baseIdName+currentNbImpls;const anchor=document.createElement("a");anchor.href="#"+currentId;addClass(anchor,"anchor");const display=document.createElement("div");display.id=currentId;addClass(display,"impl");display.appendChild(anchor);display.appendChild(code);list.appendChild(display);currentNbImpls+=1}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors)}window.register_type_impls=imp=>{if(!imp||!imp[window.currentCrate]){return}window.pending_type_impls=null;const idMap=new Map();let implementations=document.getElementById("implementations-list");let trait_implementations=document.getElementById("trait-implementations-list");let trait_implementations_header=document.getElementById("trait-implementations");const script=document.querySelector("script[data-self-path]");const selfPath=script?script.getAttribute("data-self-path"):null;const mainContent=document.querySelector("#main-content");const sidebarSection=document.querySelector(".sidebar section");let methods=document.querySelector(".sidebar .block.method");let associatedTypes=document.querySelector(".sidebar .block.associatedtype");let associatedConstants=document.querySelector(".sidebar .block.associatedconstant");let sidebarTraitList=document.querySelector(".sidebar .block.trait-implementation");for(const impList of imp[window.currentCrate]){const types=impList.slice(2);const text=impList[0];const isTrait=impList[1]!==0;const traitName=impList[1];if(types.indexOf(selfPath)===-1){continue}let outputList=isTrait?trait_implementations:implementations;if(outputList===null){const outputListName=isTrait?"Trait Implementations":"Implementations";const outputListId=isTrait?"trait-implementations-list":"implementations-list";const outputListHeaderId=isTrait?"trait-implementations":"implementations";const outputListHeader=document.createElement("h2");outputListHeader.id=outputListHeaderId;outputListHeader.innerText=outputListName;outputList=document.createElement("div");outputList.id=outputListId;if(isTrait){const link=document.createElement("a");link.href=`#${outputListHeaderId}`;link.innerText="Trait Implementations";const h=document.createElement("h3");h.appendChild(link);trait_implementations=outputList;trait_implementations_header=outputListHeader;sidebarSection.appendChild(h);sidebarTraitList=document.createElement("ul");sidebarTraitList.className="block trait-implementation";sidebarSection.appendChild(sidebarTraitList);mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}else{implementations=outputList;if(trait_implementations){mainContent.insertBefore(outputListHeader,trait_implementations_header);mainContent.insertBefore(outputList,trait_implementations_header)}else{const mainContent=document.querySelector("#main-content");mainContent.appendChild(outputListHeader);mainContent.appendChild(outputList)}}}const template=document.createElement("template");template.innerHTML=text;onEachLazy(template.content.querySelectorAll("a"),elem=>{const href=elem.getAttribute("href");if(href&&!href.startsWith("#")&&!/^(?:[a-z+]+:)?\/\//.test(href)){elem.setAttribute("href",window.rootPath+href)}});onEachLazy(template.content.querySelectorAll("[id]"),el=>{let i=0;if(idMap.has(el.id)){i=idMap.get(el.id)}else if(document.getElementById(el.id)){i=1;while(document.getElementById(`${el.id}-${2 * i}`)){i=2*i}while(document.getElementById(`${el.id}-${i}`)){i+=1}}if(i!==0){const oldHref=`#${el.id}`;const newHref=`#${el.id}-${i}`;el.id=`${el.id}-${i}`;onEachLazy(template.content.querySelectorAll("a[href]"),link=>{if(link.getAttribute("href")===oldHref){link.href=newHref}})}idMap.set(el.id,i+1)});const templateAssocItems=template.content.querySelectorAll("section.tymethod, "+"section.method, section.associatedtype, section.associatedconstant");if(isTrait){const li=document.createElement("li");const a=document.createElement("a");a.href=`#${template.content.querySelector(".impl").id}`;a.textContent=traitName;li.appendChild(a);sidebarTraitList.append(li)}else{onEachLazy(templateAssocItems,item=>{let block=hasClass(item,"associatedtype")?associatedTypes:(hasClass(item,"associatedconstant")?associatedConstants:(methods));if(!block){const blockTitle=hasClass(item,"associatedtype")?"Associated Types":(hasClass(item,"associatedconstant")?"Associated Constants":("Methods"));const blockClass=hasClass(item,"associatedtype")?"associatedtype":(hasClass(item,"associatedconstant")?"associatedconstant":("method"));const blockHeader=document.createElement("h3");const blockLink=document.createElement("a");blockLink.href="#implementations";blockLink.innerText=blockTitle;blockHeader.appendChild(blockLink);block=document.createElement("ul");block.className=`block ${blockClass}`;const insertionReference=methods||sidebarTraitList;if(insertionReference){const insertionReferenceH=insertionReference.previousElementSibling;sidebarSection.insertBefore(blockHeader,insertionReferenceH);sidebarSection.insertBefore(block,insertionReferenceH)}else{sidebarSection.appendChild(blockHeader);sidebarSection.appendChild(block)}if(hasClass(item,"associatedtype")){associatedTypes=block}else if(hasClass(item,"associatedconstant")){associatedConstants=block}else{methods=block}}const li=document.createElement("li");const a=document.createElement("a");a.innerText=item.id.split("-")[0].split(".")[1];a.href=`#${item.id}`;li.appendChild(a);block.appendChild(li)})}outputList.appendChild(template.content)}for(const list of[methods,associatedTypes,associatedConstants,sidebarTraitList]){if(!list){continue}const newChildren=Array.prototype.slice.call(list.children);newChildren.sort((a,b)=>{const aI=a.innerText;const bI=b.innerText;return aIbI?1:0});list.replaceChildren(...newChildren)}};if(window.pending_type_impls){window.register_type_impls(window.pending_type_impls)}function addSidebarCrates(){if(!window.ALL_CRATES){return}const sidebarElems=document.getElementsByClassName("sidebar-elems")[0];if(!sidebarElems){return}const h3=document.createElement("h3");h3.innerHTML="Crates";const ul=document.createElement("ul");ul.className="block crate";for(const crate of window.ALL_CRATES){const link=document.createElement("a");link.href=window.rootPath+crate+"/index.html";if(window.rootPath!=="./"&&crate===window.currentCrate){link.className="current"}link.textContent=crate;const li=document.createElement("li");li.appendChild(link);ul.appendChild(li)}sidebarElems.appendChild(h3);sidebarElems.appendChild(ul)}function expandAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);removeClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hasClass(e,"type-contents-toggle")&&!hasClass(e,"more-examples-toggle")){e.open=true}});innerToggle.title="collapse all docs";innerToggle.children[0].innerText="\u2212"}function collapseAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);addClass(innerToggle,"will-expand");onEachLazy(document.getElementsByClassName("toggle"),e=>{if(e.parentNode.id!=="implementations-list"||(!hasClass(e,"implementors-toggle")&&!hasClass(e,"type-contents-toggle"))){e.open=false}});innerToggle.title="expand all docs";innerToggle.children[0].innerText="+"}function toggleAllDocs(){const innerToggle=document.getElementById(toggleAllDocsId);if(!innerToggle){return}if(hasClass(innerToggle,"will-expand")){expandAllDocs()}else{collapseAllDocs()}}(function(){const toggles=document.getElementById(toggleAllDocsId);if(toggles){toggles.onclick=toggleAllDocs}const hideMethodDocs=getSettingValue("auto-hide-method-docs")==="true";const hideImplementations=getSettingValue("auto-hide-trait-implementations")==="true";const hideLargeItemContents=getSettingValue("auto-hide-large-items")!=="false";function setImplementorsTogglesOpen(id,open){const list=document.getElementById(id);if(list!==null){onEachLazy(list.getElementsByClassName("implementors-toggle"),e=>{e.open=open})}}if(hideImplementations){setImplementorsTogglesOpen("trait-implementations-list",false);setImplementorsTogglesOpen("blanket-implementations-list",false)}onEachLazy(document.getElementsByClassName("toggle"),e=>{if(!hideLargeItemContents&&hasClass(e,"type-contents-toggle")){e.open=true}if(hideMethodDocs&&hasClass(e,"method-toggle")){e.open=false}})}());window.rustdoc_add_line_numbers_to_examples=()=>{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");if(line_numbers.length>0){return}const count=x.textContent.split("\n").length;const elems=[];for(let i=0;i{onEachLazy(document.getElementsByClassName("rust-example-rendered"),x=>{const parent=x.parentNode;const line_numbers=parent.querySelectorAll(".example-line-numbers");for(const node of line_numbers){parent.removeChild(node)}})};if(getSettingValue("line-numbers")==="true"){window.rustdoc_add_line_numbers_to_examples()}function showSidebar(){window.hideAllModals(false);const sidebar=document.getElementsByClassName("sidebar")[0];addClass(sidebar,"shown")}function hideSidebar(){const sidebar=document.getElementsByClassName("sidebar")[0];removeClass(sidebar,"shown")}window.addEventListener("resize",()=>{if(window.CURRENT_TOOLTIP_ELEMENT){const base=window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE;const force_visible=base.TOOLTIP_FORCE_VISIBLE;hideTooltip(false);if(force_visible){showTooltip(base);base.TOOLTIP_FORCE_VISIBLE=true}}});const mainElem=document.getElementById(MAIN_ID);if(mainElem){mainElem.addEventListener("click",hideSidebar)}onEachLazy(document.querySelectorAll("a[href^='#']"),el=>{el.addEventListener("click",()=>{expandSection(el.hash.slice(1));hideSidebar()})});onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"),el=>{el.addEventListener("click",e=>{if(e.target.tagName!=="SUMMARY"&&e.target.tagName!=="A"){e.preventDefault()}})});function showTooltip(e){const notable_ty=e.getAttribute("data-notable-ty");if(!window.NOTABLE_TRAITS&¬able_ty){const data=document.getElementById("notable-traits-data");if(data){window.NOTABLE_TRAITS=JSON.parse(data.innerText)}else{throw new Error("showTooltip() called with notable without any notable traits!")}}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE===e){clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);return}window.hideAllModals(false);const wrapper=document.createElement("div");if(notable_ty){wrapper.innerHTML="
"+window.NOTABLE_TRAITS[notable_ty]+"
"}else{if(e.getAttribute("title")!==null){e.setAttribute("data-title",e.getAttribute("title"));e.removeAttribute("title")}if(e.getAttribute("data-title")!==null){const titleContent=document.createElement("div");titleContent.className="content";titleContent.appendChild(document.createTextNode(e.getAttribute("data-title")));wrapper.appendChild(titleContent)}}wrapper.className="tooltip popover";const focusCatcher=document.createElement("div");focusCatcher.setAttribute("tabindex","0");focusCatcher.onfocus=hideTooltip;wrapper.appendChild(focusCatcher);const pos=e.getBoundingClientRect();wrapper.style.top=(pos.top+window.scrollY+pos.height)+"px";wrapper.style.left=0;wrapper.style.right="auto";wrapper.style.visibility="hidden";const body=document.getElementsByTagName("body")[0];body.appendChild(wrapper);const wrapperPos=wrapper.getBoundingClientRect();const finalPos=pos.left+window.scrollX-wrapperPos.width+24;if(finalPos>0){wrapper.style.left=finalPos+"px"}else{wrapper.style.setProperty("--popover-arrow-offset",(wrapperPos.right-pos.right+4)+"px")}wrapper.style.visibility="";window.CURRENT_TOOLTIP_ELEMENT=wrapper;window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE=e;clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);wrapper.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}clearTooltipHoverTimeout(e)};wrapper.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&!e.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(wrapper,"fade-out")}}}function setTooltipHoverTimeout(element,show){clearTooltipHoverTimeout(element);if(!show&&!window.CURRENT_TOOLTIP_ELEMENT){return}if(show&&window.CURRENT_TOOLTIP_ELEMENT){return}if(window.CURRENT_TOOLTIP_ELEMENT&&window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE!==element){return}element.TOOLTIP_HOVER_TIMEOUT=setTimeout(()=>{if(show){showTooltip(element)}else if(!element.TOOLTIP_FORCE_VISIBLE){hideTooltip(false)}},show?window.RUSTDOC_TOOLTIP_HOVER_MS:window.RUSTDOC_TOOLTIP_HOVER_EXIT_MS)}function clearTooltipHoverTimeout(element){if(element.TOOLTIP_HOVER_TIMEOUT!==undefined){removeClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out");clearTimeout(element.TOOLTIP_HOVER_TIMEOUT);delete element.TOOLTIP_HOVER_TIMEOUT}}function tooltipBlurHandler(event){if(window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.contains(event.relatedTarget)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(document.activeElement)&&!window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.contains(event.relatedTarget)){setTimeout(()=>hideTooltip(false),0)}}function hideTooltip(focus){if(window.CURRENT_TOOLTIP_ELEMENT){if(window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE){if(focus){window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.focus()}window.CURRENT_TOOLTIP_ELEMENT.TOOLTIP_BASE.TOOLTIP_FORCE_VISIBLE=false}const body=document.getElementsByTagName("body")[0];body.removeChild(window.CURRENT_TOOLTIP_ELEMENT);clearTooltipHoverTimeout(window.CURRENT_TOOLTIP_ELEMENT);window.CURRENT_TOOLTIP_ELEMENT=null}}onEachLazy(document.getElementsByClassName("tooltip"),e=>{e.onclick=()=>{e.TOOLTIP_FORCE_VISIBLE=e.TOOLTIP_FORCE_VISIBLE?false:true;if(window.CURRENT_TOOLTIP_ELEMENT&&!e.TOOLTIP_FORCE_VISIBLE){hideTooltip(true)}else{showTooltip(e);window.CURRENT_TOOLTIP_ELEMENT.setAttribute("tabindex","0");window.CURRENT_TOOLTIP_ELEMENT.focus();window.CURRENT_TOOLTIP_ELEMENT.onblur=tooltipBlurHandler}return false};e.onpointerenter=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointermove=ev=>{if(ev.pointerType!=="mouse"){return}setTooltipHoverTimeout(e,true)};e.onpointerleave=ev=>{if(ev.pointerType!=="mouse"){return}if(!e.TOOLTIP_FORCE_VISIBLE&&window.CURRENT_TOOLTIP_ELEMENT&&!window.CURRENT_TOOLTIP_ELEMENT.contains(ev.relatedTarget)){setTooltipHoverTimeout(e,false);addClass(window.CURRENT_TOOLTIP_ELEMENT,"fade-out")}}});const sidebar_menu_toggle=document.getElementsByClassName("sidebar-menu-toggle")[0];if(sidebar_menu_toggle){sidebar_menu_toggle.addEventListener("click",()=>{const sidebar=document.getElementsByClassName("sidebar")[0];if(!hasClass(sidebar,"shown")){showSidebar()}else{hideSidebar()}})}function helpBlurHandler(event){blurHandler(event,getHelpButton(),window.hidePopoverMenus)}function buildHelpMenu(){const book_info=document.createElement("span");const channel=getVar("channel");book_info.className="top";book_info.innerHTML=`You can find more information in \ +the rustdoc book.`;const shortcuts=[["?","Show this help dialog"],["S","Focus the search field"],["↑","Move up in search results"],["↓","Move down in search results"],["← / →","Switch result tab (when results focused)"],["⏎","Go to active search result"],["+","Expand all sections"],["-","Collapse all sections"],].map(x=>"
"+x[0].split(" ").map((y,index)=>((index&1)===0?""+y+"":" "+y+" ")).join("")+"
"+x[1]+"
").join("");const div_shortcuts=document.createElement("div");addClass(div_shortcuts,"shortcuts");div_shortcuts.innerHTML="

Keyboard Shortcuts

"+shortcuts+"
";const infos=[`For a full list of all search features, take a look here.`,"Prefix searches with a type followed by a colon (e.g., fn:) to \ + restrict the search to a given item kind.","Accepted kinds are: fn, mod, struct, \ + enum, trait, type, macro, \ + and const.","Search functions by type signature (e.g., vec -> usize or \ + -> vec or String, enum:Cow -> bool)","You can look for items with an exact name by putting double quotes around \ + your request: \"string\"","Look for functions that accept or return \ + slices and \ + arrays by writing \ + square brackets (e.g., -> [u8] or [] -> Option)","Look for items inside another one by searching for a path: vec::Vec",].map(x=>"

"+x+"

").join("");const div_infos=document.createElement("div");addClass(div_infos,"infos");div_infos.innerHTML="

Search Tricks

"+infos;const rustdoc_version=document.createElement("span");rustdoc_version.className="bottom";const rustdoc_version_code=document.createElement("code");rustdoc_version_code.innerText="rustdoc "+getVar("rustdoc-version");rustdoc_version.appendChild(rustdoc_version_code);const container=document.createElement("div");if(!isHelpPage){container.className="popover"}container.id="help";container.style.display="none";const side_by_side=document.createElement("div");side_by_side.className="side-by-side";side_by_side.appendChild(div_shortcuts);side_by_side.appendChild(div_infos);container.appendChild(book_info);container.appendChild(side_by_side);container.appendChild(rustdoc_version);if(isHelpPage){const help_section=document.createElement("section");help_section.appendChild(container);document.getElementById("main-content").appendChild(help_section);container.style.display="block"}else{const help_button=getHelpButton();help_button.appendChild(container);container.onblur=helpBlurHandler;help_button.onblur=helpBlurHandler;help_button.children[0].onblur=helpBlurHandler}return container}window.hideAllModals=switchFocus=>{hideSidebar();window.hidePopoverMenus();hideTooltip(switchFocus)};window.hidePopoverMenus=()=>{onEachLazy(document.querySelectorAll(".search-form .popover"),elem=>{elem.style.display="none"})};function getHelpMenu(buildNeeded){let menu=getHelpButton().querySelector(".popover");if(!menu&&buildNeeded){menu=buildHelpMenu()}return menu}function showHelp(){getHelpButton().querySelector("a").focus();const menu=getHelpMenu(true);if(menu.style.display==="none"){window.hideAllModals();menu.style.display=""}}if(isHelpPage){showHelp();document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault()})}else{document.querySelector(`#${HELP_BUTTON_ID} > a`).addEventListener("click",event=>{const target=event.target;if(target.tagName!=="A"||target.parentElement.id!==HELP_BUTTON_ID||event.ctrlKey||event.altKey||event.metaKey){return}event.preventDefault();const menu=getHelpMenu(true);const shouldShowHelp=menu.style.display==="none";if(shouldShowHelp){showHelp()}else{window.hidePopoverMenus()}})}setMobileTopbar();addSidebarItems();addSidebarCrates();onHashChange(null);window.addEventListener("hashchange",onHashChange);searchState.setup()}());(function(){let reset_button_timeout=null;const but=document.getElementById("copy-path");if(!but){return}but.onclick=()=>{const parent=but.parentElement;const path=[];onEach(parent.childNodes,child=>{if(child.tagName==="A"){path.push(child.textContent)}});const el=document.createElement("textarea");el.value=path.join("::");el.setAttribute("readonly","");el.style.position="absolute";el.style.left="-9999px";document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);but.children[0].style.display="none";let tmp;if(but.childNodes.length<2){tmp=document.createTextNode("✓");but.appendChild(tmp)}else{onEachLazy(but.childNodes,e=>{if(e.nodeType===Node.TEXT_NODE){tmp=e;return true}});tmp.textContent="✓"}if(reset_button_timeout!==null){window.clearTimeout(reset_button_timeout)}function reset_button(){tmp.textContent="";reset_button_timeout=null;but.children[0].style.display=""}reset_button_timeout=window.setTimeout(reset_button,1000)}}()) \ No newline at end of file diff --git a/static.files/normalize-76eba96aa4d2e634.css b/static.files/normalize-76eba96aa4d2e634.css new file mode 100644 index 0000000..469959f --- /dev/null +++ b/static.files/normalize-76eba96aa4d2e634.css @@ -0,0 +1,2 @@ + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ +html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type="button"],[type="reset"],[type="submit"],button{-webkit-appearance:button}[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none} \ No newline at end of file diff --git a/static.files/noscript-5d8b3c7633ad77ba.css b/static.files/noscript-5d8b3c7633ad77ba.css new file mode 100644 index 0000000..8c63ef0 --- /dev/null +++ b/static.files/noscript-5d8b3c7633ad77ba.css @@ -0,0 +1 @@ + #main-content .attributes{margin-left:0 !important;}#copy-path{display:none;}nav.sub{display:none;}.src .sidebar{display:none;}.notable-traits{display:none;}:root{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);}@media (prefers-color-scheme:dark){:root{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);}} \ No newline at end of file diff --git a/static.files/rust-logo-151179464ae7ed46.svg b/static.files/rust-logo-151179464ae7ed46.svg new file mode 100644 index 0000000..62424d8 --- /dev/null +++ b/static.files/rust-logo-151179464ae7ed46.svg @@ -0,0 +1,61 @@ + + + diff --git a/static.files/rustdoc-e6a78389201e676c.css b/static.files/rustdoc-e6a78389201e676c.css new file mode 100644 index 0000000..a7efc73 --- /dev/null +++ b/static.files/rustdoc-e6a78389201e676c.css @@ -0,0 +1,10 @@ + :root{--nav-sub-mobile-padding:8px;--search-typename-width:6.75rem;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:400;src:local('Fira Sans'),url("FiraSans-Regular-018c141bf0843ffd.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Fira Sans';font-style:normal;font-weight:500;src:local('Fira Sans Medium'),url("FiraSans-Medium-8f9a781e4970d388.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:400;src:local('Source Serif 4'),url("SourceSerif4-Regular-46f98efaafac5295.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:italic;font-weight:400;src:local('Source Serif 4 Italic'),url("SourceSerif4-It-acdfaf1a8af734b1.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Serif 4';font-style:normal;font-weight:700;src:local('Source Serif 4 Bold'),url("SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:400;src:url("SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:italic;font-weight:400;src:url("SourceCodePro-It-1cc31594bf4f1f79.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'Source Code Pro';font-style:normal;font-weight:600;src:url("SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2") format("woff2");font-display:swap;}@font-face {font-family:'NanumBarunGothic';src:url("NanumBarunGothic-0f09457c7a19b7c6.ttf.woff2") format("woff2");font-display:swap;unicode-range:U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF;}*{box-sizing:border-box;}body{font:1rem/1.5 "Source Serif 4",NanumBarunGothic,serif;margin:0;position:relative;overflow-wrap:break-word;overflow-wrap:anywhere;font-feature-settings:"kern","liga";background-color:var(--main-background-color);color:var(--main-color);}h1{font-size:1.5rem;}h2{font-size:1.375rem;}h3{font-size:1.25rem;}h1,h2,h3,h4,h5,h6{font-weight:500;}h1,h2,h3,h4{margin:25px 0 15px 0;padding-bottom:6px;}.docblock h3,.docblock h4,h5,h6{margin:15px 0 5px 0;}.docblock>h2:first-child,.docblock>h3:first-child,.docblock>h4:first-child,.docblock>h5:first-child,.docblock>h6:first-child{margin-top:0;}.main-heading h1{margin:0;padding:0;flex-grow:1;overflow-wrap:break-word;overflow-wrap:anywhere;}.main-heading{display:flex;flex-wrap:wrap;padding-bottom:6px;margin-bottom:15px;}.content h2,.top-doc .docblock>h3,.top-doc .docblock>h4{border-bottom:1px solid var(--headings-border-bottom-color);}h1,h2{line-height:1.25;padding-top:3px;padding-bottom:9px;}h3.code-header{font-size:1.125rem;}h4.code-header{font-size:1rem;}.code-header{font-weight:600;margin:0;padding:0;white-space:pre-wrap;}#crate-search,h1,h2,h3,h4,h5,h6,.sidebar,.mobile-topbar,.search-input,.search-results .result-name,.item-name>a,.out-of-band,span.since,a.src,#help-button>a,summary.hideme,.scraped-example-list,ul.all-items{font-family:"Fira Sans",Arial,NanumBarunGothic,sans-serif;}#toggle-all-docs,a.anchor,.section-header a,#src-sidebar a,.rust a,.sidebar h2 a,.sidebar h3 a,.mobile-topbar h2 a,h1 a,.search-results a,.stab,.result-name i{color:var(--main-color);}span.enum,a.enum,span.struct,a.struct,span.union,a.union,span.primitive,a.primitive,span.type,a.type,span.foreigntype,a.foreigntype{color:var(--type-link-color);}span.trait,a.trait,span.traitalias,a.traitalias{color:var(--trait-link-color);}span.associatedtype,a.associatedtype,span.constant,a.constant,span.static,a.static{color:var(--assoc-item-link-color);}span.fn,a.fn,span.method,a.method,span.tymethod,a.tymethod{color:var(--function-link-color);}span.attr,a.attr,span.derive,a.derive,span.macro,a.macro{color:var(--macro-link-color);}span.mod,a.mod{color:var(--mod-link-color);}span.keyword,a.keyword{color:var(--keyword-link-color);}a{color:var(--link-color);text-decoration:none;}ol,ul{padding-left:24px;}ul ul,ol ul,ul ol,ol ol{margin-bottom:.625em;}p,.docblock>.warning{margin:0 0 .75em 0;}p:last-child,.docblock>.warning:last-child{margin:0;}button{padding:1px 6px;cursor:pointer;}button#toggle-all-docs{padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.rustdoc{display:flex;flex-direction:row;flex-wrap:nowrap;}main{position:relative;flex-grow:1;padding:10px 15px 40px 45px;min-width:0;}.src main{padding:15px;}.width-limiter{max-width:960px;margin-right:auto;}details:not(.toggle) summary{margin-bottom:.6em;}code,pre,a.test-arrow,.code-header{font-family:"Source Code Pro",monospace;}.docblock code,.docblock-short code{border-radius:3px;padding:0 0.125em;}.docblock pre code,.docblock-short pre code{padding:0;}pre{padding:14px;line-height:1.5;}pre.item-decl{overflow-x:auto;}.item-decl .type-contents-toggle{contain:initial;}.src .content pre{padding:20px;}.rustdoc.src .example-wrap pre.src-line-numbers{padding:20px 0 20px 4px;}img{max-width:100%;}.sub-logo-container,.logo-container{line-height:0;display:block;}.sub-logo-container{margin-right:32px;}.sub-logo-container>img{height:60px;width:60px;object-fit:contain;}.rust-logo{filter:var(--rust-logo-filter);}.sidebar{font-size:0.875rem;flex:0 0 200px;overflow-y:scroll;overscroll-behavior:contain;position:sticky;height:100vh;top:0;left:0;}.rustdoc.src .sidebar{flex-basis:50px;border-right:1px solid;overflow-x:hidden;overflow-y:hidden;z-index:1;}.sidebar,.mobile-topbar,.sidebar-menu-toggle,#src-sidebar-toggle,#src-sidebar{background-color:var(--sidebar-background-color);}#src-sidebar-toggle>button:hover,#src-sidebar-toggle>button:focus{background-color:var(--sidebar-background-color-hover);}.src .sidebar>*:not(#src-sidebar-toggle){visibility:hidden;}.src-sidebar-expanded .src .sidebar{overflow-y:auto;flex-basis:300px;}.src-sidebar-expanded .src .sidebar>*:not(#src-sidebar-toggle){visibility:visible;}#all-types{margin-top:1em;}*{scrollbar-width:initial;scrollbar-color:var(--scrollbar-color);}.sidebar{scrollbar-width:thin;scrollbar-color:var(--scrollbar-color);}::-webkit-scrollbar{width:12px;}.sidebar::-webkit-scrollbar{width:8px;}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0;background-color:var(--scrollbar-track-background-color);}.sidebar::-webkit-scrollbar-track{background-color:var(--scrollbar-track-background-color);}::-webkit-scrollbar-thumb,.sidebar::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-background-color);}.hidden{display:none !important;}.logo-container>img{height:48px;width:48px;}ul.block,.block li{padding:0;margin:0;list-style:none;}.sidebar-elems a,.sidebar>h2 a{display:block;padding:0.25rem;margin-left:-0.25rem;}.sidebar h2{overflow-wrap:anywhere;padding:0;margin:0.7rem 0;}.sidebar h3{font-size:1.125rem;padding:0;margin:0;}.sidebar-elems,.sidebar>.version,.sidebar>h2{padding-left:24px;}.sidebar a{color:var(--sidebar-link-color);}.sidebar .current,.sidebar .current a,.sidebar-crate a.logo-container:hover+h2 a,.sidebar a:hover:not(.logo-container){background-color:var(--sidebar-current-link-background-color);}.sidebar-elems .block{margin-bottom:2em;}.sidebar-elems .block li a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}.sidebar-crate{display:flex;align-items:center;justify-content:center;margin:14px 32px 1rem;row-gap:10px;column-gap:32px;flex-wrap:wrap;}.sidebar-crate h2{flex-grow:1;margin:0 -8px;align-self:start;}.sidebar-crate .logo-container{margin:0 -16px 0 -16px;text-align:center;}.sidebar-crate h2 a{display:block;margin:0 calc(-24px + 0.25rem) 0 -0.5rem;padding:calc((16px - 0.57rem ) / 2 ) 0.25rem;padding-left:0.5rem;}.sidebar-crate h2 .version{display:block;font-weight:normal;font-size:1rem;overflow-wrap:break-word;margin-top:calc((-16px + 0.57rem ) / 2 );}.sidebar-crate+.version{margin-top:-1rem;margin-bottom:1rem;}.mobile-topbar{display:none;}.rustdoc .example-wrap{display:flex;position:relative;margin-bottom:10px;}.rustdoc .example-wrap:last-child{margin-bottom:0px;}.rustdoc .example-wrap pre{margin:0;flex-grow:1;}.rustdoc:not(.src) .example-wrap pre{overflow:auto hidden;}.rustdoc .example-wrap pre.example-line-numbers,.rustdoc .example-wrap pre.src-line-numbers{flex-grow:0;min-width:fit-content;overflow:initial;text-align:right;-webkit-user-select:none;user-select:none;padding:14px 8px;color:var(--src-line-numbers-span-color);}.rustdoc .example-wrap pre.src-line-numbers{padding:14px 0;}.src-line-numbers a,.src-line-numbers span{color:var(--src-line-numbers-span-color);padding:0 8px;}.src-line-numbers :target{background-color:transparent;border-right:none;padding:0 8px;}.src-line-numbers .line-highlighted{background-color:var(--src-line-number-highlighted-background-color);}.search-loading{text-align:center;}.docblock-short{overflow-wrap:break-word;overflow-wrap:anywhere;}.docblock :not(pre)>code,.docblock-short code{white-space:pre-wrap;}.top-doc .docblock h2{font-size:1.375rem;}.top-doc .docblock h3{font-size:1.25rem;}.top-doc .docblock h4,.top-doc .docblock h5{font-size:1.125rem;}.top-doc .docblock h6{font-size:1rem;}.docblock h5{font-size:1rem;}.docblock h6{font-size:0.875rem;}.docblock{margin-left:24px;position:relative;}.docblock>:not(.more-examples-toggle):not(.example-wrap){max-width:100%;overflow-x:auto;}.out-of-band{flex-grow:0;font-size:1.125rem;}.docblock code,.docblock-short code,pre,.rustdoc.src .example-wrap{background-color:var(--code-block-background-color);}#main-content{position:relative;}.docblock table{margin:.5em 0;border-collapse:collapse;}.docblock table td,.docblock table th{padding:.5em;border:1px solid var(--border-color);}.docblock table tbody tr:nth-child(2n){background:var(--table-alt-row-background-color);}.method .where,.fn .where,.where.fmt-newline{display:block;white-space:pre-wrap;font-size:0.875rem;}.item-info{display:block;margin-left:24px;}.item-info code{font-size:0.875rem;}#main-content>.item-info{margin-left:0;}nav.sub{flex-grow:1;flex-flow:row nowrap;margin:4px 0 25px 0;display:flex;align-items:center;}.search-form{position:relative;display:flex;height:34px;flex-grow:1;}.src nav.sub{margin:0 0 15px 0;}.section-header{display:block;position:relative;}.section-header:hover>.anchor,.impl:hover>.anchor,.trait-impl:hover>.anchor,.variant:hover>.anchor{display:initial;}.anchor{display:none;position:absolute;left:-0.5em;background:none !important;}.anchor.field{left:-5px;}.section-header>.anchor{left:-15px;padding-right:8px;}h2.section-header>.anchor{padding-right:6px;}.main-heading a:hover,.example-wrap .rust a:hover,.all-items a:hover,.docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover,.item-info a{text-decoration:underline;}.crate.block a.current{font-weight:500;}table,.item-table{overflow-wrap:break-word;}.item-table{display:table;padding:0;margin:0;}.item-table>li{display:table-row;}.item-table>li>div{display:table-cell;}.item-table>li>.item-name{padding-right:1.25rem;}.search-results-title{margin-top:0;white-space:nowrap;display:flex;align-items:baseline;}#crate-search-div{position:relative;min-width:5em;}#crate-search{min-width:115px;padding:0 23px 0 4px;max-width:100%;text-overflow:ellipsis;border:1px solid var(--border-color);border-radius:4px;outline:none;cursor:pointer;-moz-appearance:none;-webkit-appearance:none;text-indent:0.01px;background-color:var(--main-background-color);color:inherit;line-height:1.5;font-weight:500;}#crate-search:hover,#crate-search:focus{border-color:var(--crate-search-hover-border);}#crate-search-div::after{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0;content:"";background-repeat:no-repeat;background-size:20px;background-position:calc(100% - 2px) 56%;background-image:url('data:image/svg+xml, \ + ');filter:var(--crate-search-div-filter);}#crate-search-div:hover::after,#crate-search-div:focus-within::after{filter:var(--crate-search-div-hover-filter);}#crate-search>option{font-size:1rem;}.search-input{-webkit-appearance:none;outline:none;border:1px solid var(--border-color);border-radius:2px;padding:8px;font-size:1rem;flex-grow:1;background-color:var(--button-background-color);color:var(--search-color);}.search-input:focus{border-color:var(--search-input-focused-border-color);}.search-results{display:none;}.search-results.active{display:block;}.search-results>a{display:flex;margin-left:2px;margin-right:2px;border-bottom:1px solid var(--search-result-border-color);gap:1em;}.search-results>a>div.desc{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;flex:2;}.search-results a:hover,.search-results a:focus{background-color:var(--search-result-link-focus-background-color);}.search-results .result-name{display:flex;align-items:center;justify-content:start;flex:3;}.search-results .result-name .alias{color:var(--search-results-alias-color);}.search-results .result-name .grey{color:var(--search-results-grey-color);}.search-results .result-name .typename{color:var(--search-results-grey-color);font-size:0.875rem;width:var(--search-typename-width);}.search-results .result-name .path{word-break:break-all;max-width:calc(100% - var(--search-typename-width));display:inline-block;}.search-results .result-name .path>*{display:inline;}.popover{position:absolute;top:100%;right:0;z-index:2;margin-top:7px;border-radius:3px;border:1px solid var(--border-color);background-color:var(--main-background-color);color:var(--main-color);--popover-arrow-offset:11px;}.popover::before{content:'';position:absolute;right:var(--popover-arrow-offset);border:solid var(--border-color);border-width:1px 1px 0 0;background-color:var(--main-background-color);padding:4px;transform:rotate(-45deg);top:-5px;}.setting-line{margin:1.2em 0.6em;}.setting-radio input,.setting-check input{margin-right:0.3em;height:1.2rem;width:1.2rem;border:2px solid var(--settings-input-border-color);outline:none;-webkit-appearance:none;cursor:pointer;}.setting-radio input{border-radius:50%;}.setting-radio span,.setting-check span{padding-bottom:1px;}.setting-radio{margin-top:0.1em;margin-bottom:0.1em;min-width:3.8em;padding:0.3em;display:inline-flex;align-items:center;cursor:pointer;}.setting-radio+.setting-radio{margin-left:0.5em;}.setting-check{margin-right:20px;display:flex;align-items:center;cursor:pointer;}.setting-radio input:checked{box-shadow:inset 0 0 0 3px var(--main-background-color);background-color:var(--settings-input-color);}.setting-check input:checked{background-color:var(--settings-input-color);border-width:1px;content:url('data:image/svg+xml,\ + \ + ');}.setting-radio input:focus,.setting-check input:focus{box-shadow:0 0 1px 1px var(--settings-input-color);}.setting-radio input:checked:focus{box-shadow:inset 0 0 0 3px var(--main-background-color),0 0 2px 2px var(--settings-input-color);}.setting-radio input:hover,.setting-check input:hover{border-color:var(--settings-input-color) !important;}#help.popover{max-width:600px;--popover-arrow-offset:48px;}#help dt{float:left;clear:left;margin-right:0.5rem;}#help span.top,#help span.bottom{text-align:center;display:block;font-size:1.125rem;}#help span.top{margin:10px 0;border-bottom:1px solid var(--border-color);padding-bottom:4px;margin-bottom:6px;}#help span.bottom{clear:both;border-top:1px solid var(--border-color);}.side-by-side>div{width:50%;float:left;padding:0 20px 20px 17px;}.item-info .stab{min-height:36px;display:flex;padding:3px;margin-bottom:5px;align-items:center;vertical-align:text-bottom;}.item-name .stab{margin-left:0.3125em;}.stab{padding:0 2px;font-size:0.875rem;font-weight:normal;color:var(--main-color);background-color:var(--stab-background-color);width:fit-content;white-space:pre-wrap;border-radius:3px;display:inline;vertical-align:baseline;}.stab.portability>code{background:none;color:var(--stab-code-color);}.stab .emoji{font-size:1.25rem;margin-right:0.3rem;}.emoji{text-shadow:1px 0 0 black,-1px 0 0 black,0 1px 0 black,0 -1px 0 black;}.since{font-weight:normal;font-size:initial;}.rightside{padding-left:12px;float:right;}.rightside:not(a),.out-of-band{color:var(--right-side-color);}pre.rust{tab-size:4;-moz-tab-size:4;}pre.rust .kw{color:var(--code-highlight-kw-color);}pre.rust .kw-2{color:var(--code-highlight-kw-2-color);}pre.rust .lifetime{color:var(--code-highlight-lifetime-color);}pre.rust .prelude-ty{color:var(--code-highlight-prelude-color);}pre.rust .prelude-val{color:var(--code-highlight-prelude-val-color);}pre.rust .string{color:var(--code-highlight-string-color);}pre.rust .number{color:var(--code-highlight-number-color);}pre.rust .bool-val{color:var(--code-highlight-literal-color);}pre.rust .self{color:var(--code-highlight-self-color);}pre.rust .attr{color:var(--code-highlight-attribute-color);}pre.rust .macro,pre.rust .macro-nonterminal{color:var(--code-highlight-macro-color);}pre.rust .question-mark{font-weight:bold;color:var(--code-highlight-question-mark-color);}pre.rust .comment{color:var(--code-highlight-comment-color);}pre.rust .doccomment{color:var(--code-highlight-doc-comment-color);}.rustdoc.src .example-wrap pre.rust a{background:var(--codeblock-link-background);}.example-wrap.compile_fail,.example-wrap.should_panic{border-left:2px solid var(--codeblock-error-color);}.ignore.example-wrap{border-left:2px solid var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover,.example-wrap.should_panic:hover{border-left:2px solid var(--codeblock-error-hover-color);}.example-wrap.ignore:hover{border-left:2px solid var(--codeblock-ignore-hover-color);}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip{color:var(--codeblock-error-color);}.example-wrap.ignore .tooltip{color:var(--codeblock-ignore-color);}.example-wrap.compile_fail:hover .tooltip,.example-wrap.should_panic:hover .tooltip{color:var(--codeblock-error-hover-color);}.example-wrap.ignore:hover .tooltip{color:var(--codeblock-ignore-hover-color);}.example-wrap .tooltip{position:absolute;display:block;left:-25px;top:5px;margin:0;line-height:1;}.example-wrap.compile_fail .tooltip,.example-wrap.should_panic .tooltip,.example-wrap.ignore .tooltip{font-weight:bold;font-size:1.25rem;}.content .docblock .warning{border-left:2px solid var(--warning-border-color);padding:14px;position:relative;overflow-x:visible !important;}.content .docblock .warning::before{color:var(--warning-border-color);content:"ⓘ";position:absolute;left:-25px;top:5px;font-weight:bold;font-size:1.25rem;}a.test-arrow{visibility:hidden;position:absolute;padding:5px 10px 5px 10px;border-radius:5px;font-size:1.375rem;top:5px;right:5px;z-index:1;color:var(--test-arrow-color);background-color:var(--test-arrow-background-color);}a.test-arrow:hover{color:var(--test-arrow-hover-color);background-color:var(--test-arrow-hover-background-color);}.example-wrap:hover .test-arrow{visibility:visible;}.code-attribute{font-weight:300;color:var(--code-attribute-color);}.item-spacer{width:100%;height:12px;display:block;}.out-of-band>span.since{font-size:1.25rem;}.sub-variant h4{font-size:1rem;font-weight:400;margin-top:0;margin-bottom:0;}.sub-variant{margin-left:24px;margin-bottom:40px;}.sub-variant>.sub-variant-field{margin-left:24px;}:target{padding-right:3px;background-color:var(--target-background-color);border-right:3px solid var(--target-border-color);}.code-header a.tooltip{color:inherit;margin-right:15px;position:relative;}.code-header a.tooltip:hover{color:var(--link-color);}a.tooltip:hover::after{position:absolute;top:calc(100% - 10px);left:-15px;right:-15px;height:20px;content:"\00a0";}.fade-out{opacity:0;transition:opacity 0.45s cubic-bezier(0,0,0.1,1.0);}.popover.tooltip .content{margin:0.25em 0.5em;}.popover.tooltip .content pre,.popover.tooltip .content code{background:transparent;margin:0;padding:0;font-size:1.25rem;white-space:pre-wrap;}.popover.tooltip .content>h3:first-child{margin:0 0 5px 0;}.search-failed{text-align:center;margin-top:20px;display:none;}.search-failed.active{display:block;}.search-failed>ul{text-align:left;max-width:570px;margin-left:auto;margin-right:auto;}#search-tabs{display:flex;flex-direction:row;gap:1px;margin-bottom:4px;}#search-tabs button{text-align:center;font-size:1.125rem;border:0;border-top:2px solid;flex:1;line-height:1.5;color:inherit;}#search-tabs button:not(.selected){background-color:var(--search-tab-button-not-selected-background);border-top-color:var(--search-tab-button-not-selected-border-top-color);}#search-tabs button:hover,#search-tabs button.selected{background-color:var(--search-tab-button-selected-background);border-top-color:var(--search-tab-button-selected-border-top-color);}#search-tabs .count{font-size:1rem;font-variant-numeric:tabular-nums;color:var(--search-tab-title-count-color);}#search .error code{border-radius:3px;background-color:var(--search-error-code-background-color);}.search-corrections{font-weight:normal;}#src-sidebar-toggle{position:sticky;top:0;left:0;font-size:1.25rem;border-bottom:1px solid;display:flex;height:40px;justify-content:stretch;align-items:stretch;z-index:10;}#src-sidebar{width:100%;overflow:auto;}#src-sidebar>.title{font-size:1.5rem;text-align:center;border-bottom:1px solid var(--border-color);margin-bottom:6px;}#src-sidebar div.files>a:hover,details.dir-entry summary:hover,#src-sidebar div.files>a:focus,details.dir-entry summary:focus{background-color:var(--src-sidebar-background-hover);}#src-sidebar div.files>a.selected{background-color:var(--src-sidebar-background-selected);}#src-sidebar-toggle>button{font-size:inherit;font-weight:bold;background:none;color:inherit;text-align:center;border:none;outline:none;flex:1 1;-webkit-appearance:none;opacity:1;}#settings-menu,#help-button{margin-left:4px;display:flex;}#settings-menu>a,#help-button>a{display:flex;align-items:center;justify-content:center;background-color:var(--button-background-color);border:1px solid var(--border-color);border-radius:2px;color:var(--settings-button-color);font-size:20px;width:33px;}#settings-menu>a:hover,#settings-menu>a:focus,#help-button>a:hover,#help-button>a:focus{border-color:var(--settings-button-border-focus);}#copy-path{color:var(--copy-path-button-color);background:var(--main-background-color);height:34px;margin-left:10px;padding:0;padding-left:2px;border:0;width:33px;}#copy-path>img{filter:var(--copy-path-img-filter);}#copy-path:hover>img{filter:var(--copy-path-img-hover-filter);}@keyframes rotating{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}#settings-menu.rotate>a img{animation:rotating 2s linear infinite;}kbd{display:inline-block;padding:3px 5px;font:15px monospace;line-height:10px;vertical-align:middle;border:solid 1px var(--border-color);border-radius:3px;color:var(--kbd-color);background-color:var(--kbd-background);box-shadow:inset 0 -1px 0 var(--kbd-box-shadow-color);}ul.all-items>li{list-style:none;}details.dir-entry{padding-left:4px;}details.dir-entry>summary{margin:0 0 0 -4px;padding:0 0 0 4px;cursor:pointer;}details.dir-entry div.folders,details.dir-entry div.files{padding-left:23px;}details.dir-entry a{display:block;}details.toggle{contain:layout;position:relative;}details.toggle>summary.hideme{cursor:pointer;font-size:1rem;}details.toggle>summary{list-style:none;outline:none;}details.toggle>summary::-webkit-details-marker,details.toggle>summary::marker{display:none;}details.toggle>summary.hideme>span{margin-left:9px;}details.toggle>summary::before{background:url('data:image/svg+xml,') no-repeat top left;content:"";cursor:pointer;width:16px;height:16px;display:inline-block;vertical-align:middle;opacity:.5;filter:var(--toggle-filter);}details.toggle>summary.hideme>span,.more-examples-toggle summary,.more-examples-toggle .hide-more{color:var(--toggles-color);}details.toggle>summary::after{content:"Expand";overflow:hidden;width:0;height:0;position:absolute;}details.toggle>summary.hideme::after{content:"";}details.toggle>summary:focus::before,details.toggle>summary:hover::before{opacity:1;}details.toggle>summary:focus-visible::before{outline:1px dotted #000;outline-offset:1px;}details.non-exhaustive{margin-bottom:8px;}details.toggle>summary.hideme::before{position:relative;}details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;top:4px;}.impl-items>details.toggle>summary:not(.hideme)::before{position:absolute;left:-24px;}details.toggle[open] >summary.hideme{position:absolute;}details.toggle[open] >summary.hideme>span{display:none;}details.toggle[open] >summary::before{background:url('data:image/svg+xml,') no-repeat top left;}details.toggle[open] >summary::after{content:"Collapse";}.docblock summary>*{display:inline-block;}.docblock>.example-wrap:first-child .tooltip{margin-top:16px;}@media (max-width:850px){#search-tabs .count{display:block;}}@media (max-width:700px){*[id]{scroll-margin-top:45px;}.rustdoc{display:block;}main{padding-left:15px;padding-top:0px;}.main-heading{flex-direction:column;}.out-of-band{text-align:left;margin-left:initial;padding:initial;}.out-of-band .since::before{content:"Since ";}.sidebar .logo-container,.sidebar .location{display:none;}.sidebar{position:fixed;top:45px;left:-1000px;z-index:11;height:calc(100vh - 45px);width:200px;}.src main,.rustdoc.src .sidebar{top:0;padding:0;height:100vh;border:0;}.sidebar.shown,.src-sidebar-expanded .src .sidebar,.rustdoc:not(.src) .sidebar:focus-within{left:0;}.mobile-topbar h2{padding-bottom:0;margin:auto 0.5em auto auto;overflow:hidden;font-size:24px;}.mobile-topbar h2 a{display:block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}.mobile-topbar .logo-container>img{max-width:35px;max-height:35px;margin:5px 0 5px 20px;}.mobile-topbar{display:flex;flex-direction:row;position:sticky;z-index:10;font-size:2rem;height:45px;width:100%;left:0;top:0;}.sidebar-menu-toggle{width:45px;font-size:32px;border:none;color:var(--main-color);}.sidebar-elems{margin-top:1em;}.anchor{display:none !important;}#main-content>details.toggle>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}#src-sidebar-toggle{position:fixed;left:1px;top:100px;width:30px;font-size:1.5rem;padding:0;z-index:10;border-top-right-radius:3px;border-bottom-right-radius:3px;border:1px solid;border-left:0;}.src-sidebar-expanded #src-sidebar-toggle{left:unset;top:unset;width:unset;border-top-right-radius:unset;border-bottom-right-radius:unset;position:sticky;border:0;border-bottom:1px solid;}#copy-path,#help-button{display:none;}.item-table,.item-row,.item-table>li,.item-table>li>div,.search-results>a,.search-results>a>div{display:block;}.search-results>a{padding:5px 0px;}.search-results>a>div.desc,.item-table>li>div.desc{padding-left:2em;}.search-results .result-name{display:block;}.search-results .result-name .typename{width:initial;margin-right:0;}.search-results .result-name .typename,.search-results .result-name .path{display:inline;}.src-sidebar-expanded .src .sidebar{max-width:100vw;width:100vw;}details.toggle:not(.top-doc)>summary{margin-left:10px;}.impl-items>details.toggle>summary:not(.hideme)::before,#main-content>details.toggle:not(.top-doc)>summary::before,#main-content>div>details.toggle>summary::before{left:-11px;}.impl-items>.item-info{margin-left:34px;}.src nav.sub{margin:0;padding:var(--nav-sub-mobile-padding);}}@media (min-width:701px){.scraped-example-title{position:absolute;z-index:10;background:var(--main-background-color);bottom:8px;right:5px;padding:2px 4px;box-shadow:0 0 4px var(--main-background-color);}}@media print{nav.sidebar,nav.sub,.out-of-band,a.src,#copy-path,details.toggle[open] >summary::before,details.toggle>summary::before,details.toggle.top-doc>summary{display:none;}.docblock{margin-left:0;}main{padding:10px;}}@media (max-width:464px){.docblock{margin-left:12px;}.docblock code{overflow-wrap:break-word;overflow-wrap:anywhere;}nav.sub{flex-direction:column;}.search-form{align-self:stretch;}.sub-logo-container>img{height:35px;width:35px;margin-bottom:var(--nav-sub-mobile-padding);}}.variant,.implementors-toggle>summary,.impl,#implementors-list>.docblock,.impl-items>section,.impl-items>.toggle>summary,.methods>section,.methods>.toggle>summary{margin-bottom:0.75em;}.variants>.docblock,.implementors-toggle>.docblock,.impl-items>.toggle[open]:not(:last-child),.methods>.toggle[open]:not(:last-child),.implementors-toggle[open]:not(:last-child){margin-bottom:2em;}#trait-implementations-list .impl-items>.toggle:not(:last-child),#synthetic-implementations-list .impl-items>.toggle:not(:last-child),#blanket-implementations-list .impl-items>.toggle:not(:last-child){margin-bottom:1em;}.scraped-example-list .scrape-help{margin-left:10px;padding:0 4px;font-weight:normal;font-size:12px;position:relative;bottom:1px;border:1px solid var(--scrape-example-help-border-color);border-radius:50px;color:var(--scrape-example-help-color);}.scraped-example-list .scrape-help:hover{border-color:var(--scrape-example-help-hover-border-color);color:var(--scrape-example-help-hover-color);}.scraped-example{position:relative;}.scraped-example .code-wrapper{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;width:100%;}.scraped-example:not(.expanded) .code-wrapper{max-height:calc(1.5em * 5 + 10px);}.scraped-example:not(.expanded) .code-wrapper pre{overflow-y:hidden;padding-bottom:0;max-height:calc(1.5em * 5 + 10px);}.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper,.more-scraped-examples .scraped-example:not(.expanded) .code-wrapper pre{max-height:calc(1.5em * 10 + 10px);}.scraped-example .code-wrapper .next,.scraped-example .code-wrapper .prev,.scraped-example .code-wrapper .expand{color:var(--main-color);position:absolute;top:0.25em;z-index:1;padding:0;background:none;border:none;-webkit-appearance:none;opacity:1;}.scraped-example .code-wrapper .prev{right:2.25em;}.scraped-example .code-wrapper .next{right:1.25em;}.scraped-example .code-wrapper .expand{right:0.25em;}.scraped-example:not(.expanded) .code-wrapper::before,.scraped-example:not(.expanded) .code-wrapper::after{content:" ";width:100%;height:5px;position:absolute;z-index:1;}.scraped-example:not(.expanded) .code-wrapper::before{top:0;background:linear-gradient(to bottom,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example:not(.expanded) .code-wrapper::after{bottom:0;background:linear-gradient(to top,var(--scrape-example-code-wrapper-background-start),var(--scrape-example-code-wrapper-background-end));}.scraped-example .code-wrapper .example-wrap{width:100%;overflow-y:hidden;margin-bottom:0;}.scraped-example:not(.expanded) .code-wrapper .example-wrap{overflow-x:hidden;}.scraped-example .example-wrap .rust span.highlight{background:var(--scrape-example-code-line-highlight);}.scraped-example .example-wrap .rust span.highlight.focus{background:var(--scrape-example-code-line-highlight-focus);}.more-examples-toggle{max-width:calc(100% + 25px);margin-top:10px;margin-left:-25px;}.more-examples-toggle .hide-more{margin-left:25px;cursor:pointer;}.more-scraped-examples{margin-left:25px;position:relative;}.toggle-line{position:absolute;top:5px;bottom:0;right:calc(100% + 10px);padding:0 4px;cursor:pointer;}.toggle-line-inner{min-width:2px;height:100%;background:var(--scrape-example-toggle-line-background);}.toggle-line:hover .toggle-line-inner{background:var(--scrape-example-toggle-line-hover-background);}.more-scraped-examples .scraped-example,.example-links{margin-top:20px;}.more-scraped-examples .scraped-example:first-child{margin-top:5px;}.example-links ul{margin-bottom:0;}:root[data-theme="light"]{--main-background-color:white;--main-color:black;--settings-input-color:#2196f3;--settings-input-border-color:#717171;--settings-button-color:#000;--settings-button-border-focus:#717171;--sidebar-background-color:#f5f5f5;--sidebar-background-color-hover:#e0e0e0;--code-block-background-color:#f5f5f5;--scrollbar-track-background-color:#dcdcdc;--scrollbar-thumb-background-color:rgba(36,37,39,0.6);--scrollbar-color:rgba(36,37,39,0.6) #d9d9d9;--headings-border-bottom-color:#ddd;--border-color:#e0e0e0;--button-background-color:#fff;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:none;--search-input-focused-border-color:#66afe9;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(35%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ad378a;--trait-link-color:#6e4fc9;--assoc-item-link-color:#3873ad;--function-link-color:#ad7c37;--macro-link-color:#068000;--keyword-link-color:#3873ad;--mod-link-color:#3873ad;--link-color:#3873ad;--sidebar-link-color:#356da4;--sidebar-current-link-background-color:#fff;--search-result-link-focus-background-color:#ccc;--search-result-border-color:#aaa3;--search-color:#000;--search-error-code-background-color:#d0cccc;--search-results-alias-color:#000;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#e6e6e6;--search-tab-button-not-selected-background:#e6e6e6;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#fff;--stab-background-color:#fff5d6;--stab-code-color:#000;--code-highlight-kw-color:#8959a8;--code-highlight-kw-2-color:#4271ae;--code-highlight-lifetime-color:#b76514;--code-highlight-prelude-color:#4271ae;--code-highlight-prelude-val-color:#c82829;--code-highlight-number-color:#718c00;--code-highlight-string-color:#718c00;--code-highlight-literal-color:#c82829;--code-highlight-attribute-color:#c82829;--code-highlight-self-color:#c82829;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8e908c;--code-highlight-doc-comment-color:#4d4d4c;--src-line-numbers-span-color:#c67e2d;--src-line-number-highlighted-background-color:#fdffd3;--test-arrow-color:#f5f5f5;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#f5f5f5;--test-arrow-hover-background-color:rgb(78,139,202);--target-background-color:#fdffd3;--target-border-color:#ad7c37;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:initial;--crate-search-div-filter:invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg) brightness(114%) contrast(76%);--crate-search-div-hover-filter:invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%);--crate-search-hover-border:#717171;--src-sidebar-background-selected:#fff;--src-sidebar-background-hover:#e0e0e0;--table-alt-row-background-color:#f5f5f5;--codeblock-link-background:#eee;--scrape-example-toggle-line-background:#ccc;--scrape-example-toggle-line-hover-background:#999;--scrape-example-code-line-highlight:#fcffd6;--scrape-example-code-line-highlight-focus:#f6fdb0;--scrape-example-help-border-color:#555;--scrape-example-help-color:#333;--scrape-example-help-hover-border-color:#000;--scrape-example-help-hover-color:#000;--scrape-example-code-wrapper-background-start:rgba(255,255,255,1);--scrape-example-code-wrapper-background-end:rgba(255,255,255,0);}:root[data-theme="dark"]{--main-background-color:#353535;--main-color:#ddd;--settings-input-color:#2196f3;--settings-input-border-color:#999;--settings-button-color:#000;--settings-button-border-focus:#ffb900;--sidebar-background-color:#505050;--sidebar-background-color-hover:#676767;--code-block-background-color:#2A2A2A;--scrollbar-track-background-color:#717171;--scrollbar-thumb-background-color:rgba(32,34,37,.6);--scrollbar-color:rgba(32,34,37,.6) #5a5a5a;--headings-border-bottom-color:#d2d2d2;--border-color:#e0e0e0;--button-background-color:#f0f0f0;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#008dfd;--copy-path-button-color:#999;--copy-path-img-filter:invert(50%);--copy-path-img-hover-filter:invert(65%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#2dbfb8;--trait-link-color:#b78cf2;--assoc-item-link-color:#d2991d;--function-link-color:#2bab63;--macro-link-color:#09bd00;--keyword-link-color:#d2991d;--mod-link-color:#d2991d;--link-color:#d2991d;--sidebar-link-color:#fdbf35;--sidebar-current-link-background-color:#444;--search-result-link-focus-background-color:#616161;--search-result-border-color:#aaa3;--search-color:#111;--search-error-code-background-color:#484848;--search-results-alias-color:#fff;--search-results-grey-color:#ccc;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:#252525;--search-tab-button-not-selected-background:#252525;--search-tab-button-selected-border-top-color:#0089ff;--search-tab-button-selected-background:#353535;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ab8ac1;--code-highlight-kw-2-color:#769acb;--code-highlight-lifetime-color:#d97f26;--code-highlight-prelude-color:#769acb;--code-highlight-prelude-val-color:#ee6868;--code-highlight-number-color:#83a300;--code-highlight-string-color:#83a300;--code-highlight-literal-color:#ee6868;--code-highlight-attribute-color:#ee6868;--code-highlight-self-color:#ee6868;--code-highlight-macro-color:#3e999f;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#8d8d8b;--code-highlight-doc-comment-color:#8ca375;--src-line-numbers-span-color:#3b91e2;--src-line-number-highlighted-background-color:#0a042f;--test-arrow-color:#dedede;--test-arrow-background-color:rgba(78,139,202,0.2);--test-arrow-hover-color:#dedede;--test-arrow-hover-background-color:#4e8bca;--target-background-color:#494a3d;--target-border-color:#bb7410;--kbd-color:#000;--kbd-background:#fafbfc;--kbd-box-shadow-color:#c6cbd1;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(94%) sepia(0%) saturate(721%) hue-rotate(255deg) brightness(90%) contrast(90%);--crate-search-div-hover-filter:invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%);--crate-search-hover-border:#2196f3;--src-sidebar-background-selected:#333;--src-sidebar-background-hover:#444;--table-alt-row-background-color:#2a2a2a;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(53,53,53,1);--scrape-example-code-wrapper-background-end:rgba(53,53,53,0);}:root[data-theme="ayu"]{--main-background-color:#0f1419;--main-color:#c5c5c5;--settings-input-color:#ffb454;--settings-input-border-color:#999;--settings-button-color:#fff;--settings-button-border-focus:#e0e0e0;--sidebar-background-color:#14191f;--sidebar-background-color-hover:rgba(70,70,70,0.33);--code-block-background-color:#191f26;--scrollbar-track-background-color:transparent;--scrollbar-thumb-background-color:#5c6773;--scrollbar-color:#5c6773 #24292f;--headings-border-bottom-color:#5c6773;--border-color:#5c6773;--button-background-color:#141920;--right-side-color:grey;--code-attribute-color:#999;--toggles-color:#999;--toggle-filter:invert(100%);--search-input-focused-border-color:#5c6773;--copy-path-button-color:#fff;--copy-path-img-filter:invert(70%);--copy-path-img-hover-filter:invert(100%);--codeblock-error-hover-color:rgb(255,0,0);--codeblock-error-color:rgba(255,0,0,.5);--codeblock-ignore-hover-color:rgb(255,142,0);--codeblock-ignore-color:rgba(255,142,0,.6);--warning-border-color:#ff8e00;--type-link-color:#ffa0a5;--trait-link-color:#39afd7;--assoc-item-link-color:#39afd7;--function-link-color:#fdd687;--macro-link-color:#a37acc;--keyword-link-color:#39afd7;--mod-link-color:#39afd7;--link-color:#39afd7;--sidebar-link-color:#53b1db;--sidebar-current-link-background-color:transparent;--search-result-link-focus-background-color:#3c3c3c;--search-result-border-color:#aaa3;--search-color:#fff;--search-error-code-background-color:#4f4c4c;--search-results-alias-color:#c5c5c5;--search-results-grey-color:#999;--search-tab-title-count-color:#888;--search-tab-button-not-selected-border-top-color:none;--search-tab-button-not-selected-background:transparent !important;--search-tab-button-selected-border-top-color:none;--search-tab-button-selected-background:#141920 !important;--stab-background-color:#314559;--stab-code-color:#e6e1cf;--code-highlight-kw-color:#ff7733;--code-highlight-kw-2-color:#ff7733;--code-highlight-lifetime-color:#ff7733;--code-highlight-prelude-color:#69f2df;--code-highlight-prelude-val-color:#ff7733;--code-highlight-number-color:#b8cc52;--code-highlight-string-color:#b8cc52;--code-highlight-literal-color:#ff7733;--code-highlight-attribute-color:#e6e1cf;--code-highlight-self-color:#36a3d9;--code-highlight-macro-color:#a37acc;--code-highlight-question-mark-color:#ff9011;--code-highlight-comment-color:#788797;--code-highlight-doc-comment-color:#a1ac88;--src-line-numbers-span-color:#5c6773;--src-line-number-highlighted-background-color:rgba(255,236,164,0.06);--test-arrow-color:#788797;--test-arrow-background-color:rgba(57,175,215,0.09);--test-arrow-hover-color:#c5c5c5;--test-arrow-hover-background-color:rgba(57,175,215,0.368);--target-background-color:rgba(255,236,164,0.06);--target-border-color:rgba(255,180,76,0.85);--kbd-color:#c5c5c5;--kbd-background:#314559;--kbd-box-shadow-color:#5c6773;--rust-logo-filter:drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);--crate-search-div-filter:invert(41%) sepia(12%) saturate(487%) hue-rotate(171deg) brightness(94%) contrast(94%);--crate-search-div-hover-filter:invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg) brightness(113%) contrast(76%);--crate-search-hover-border:#e0e0e0;--src-sidebar-background-selected:#14191f;--src-sidebar-background-hover:#14191f;--table-alt-row-background-color:#191f26;--codeblock-link-background:#333;--scrape-example-toggle-line-background:#999;--scrape-example-toggle-line-hover-background:#c5c5c5;--scrape-example-code-line-highlight:#5b3b01;--scrape-example-code-line-highlight-focus:#7c4b0f;--scrape-example-help-border-color:#aaa;--scrape-example-help-color:#eee;--scrape-example-help-hover-border-color:#fff;--scrape-example-help-hover-color:#fff;--scrape-example-code-wrapper-background-start:rgba(15,20,25,1);--scrape-example-code-wrapper-background-end:rgba(15,20,25,0);}:root[data-theme="ayu"] h1,:root[data-theme="ayu"] h2,:root[data-theme="ayu"] h3,:root[data-theme="ayu"] h4,:where(:root[data-theme="ayu"]) h1 a,:root[data-theme="ayu"] .sidebar h2 a,:root[data-theme="ayu"] .sidebar h3 a,:root[data-theme="ayu"] #source-sidebar>.title{color:#fff;}:root[data-theme="ayu"] .docblock code{color:#ffb454;}:root[data-theme="ayu"] .docblock a>code{color:#39AFD7 !important;}:root[data-theme="ayu"] .code-header,:root[data-theme="ayu"] .docblock pre>code,:root[data-theme="ayu"] pre,:root[data-theme="ayu"] pre>code,:root[data-theme="ayu"] .item-info code,:root[data-theme="ayu"] .rustdoc.source .example-wrap{color:#e6e1cf;}:root[data-theme="ayu"] .sidebar .current,:root[data-theme="ayu"] .sidebar a:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:hover,:root[data-theme="ayu"] details.dir-entry summary:hover,:root[data-theme="ayu"] #src-sidebar div.files>a:focus,:root[data-theme="ayu"] details.dir-entry summary:focus,:root[data-theme="ayu"] #src-sidebar div.files>a.selected{color:#ffb44c;}:root[data-theme="ayu"] .sidebar-elems .location{color:#ff7733;}:root[data-theme="ayu"] .src-line-numbers .line-highlighted{color:#708090;padding-right:7px;border-right:1px solid #ffb44c;}:root[data-theme="ayu"] .search-results a:hover,:root[data-theme="ayu"] .search-results a:focus{color:#fff !important;background-color:#3c3c3c;}:root[data-theme="ayu"] .search-results a{color:#0096cf;}:root[data-theme="ayu"] .search-results a div.desc{color:#c5c5c5;}:root[data-theme="ayu"] .result-name .primitive>i,:root[data-theme="ayu"] .result-name .keyword>i{color:#788797;}:root[data-theme="ayu"] #search-tabs>button.selected{border-bottom:1px solid #ffb44c !important;border-top:none;}:root[data-theme="ayu"] #search-tabs>button:not(.selected){border:none;background-color:transparent !important;}:root[data-theme="ayu"] #search-tabs>button:hover{border-bottom:1px solid rgba(242,151,24,0.3);}:root[data-theme="ayu"] #settings-menu>a img{filter:invert(100);} \ No newline at end of file diff --git a/static.files/scrape-examples-ef1e698c1d417c0c.js b/static.files/scrape-examples-ef1e698c1d417c0c.js new file mode 100644 index 0000000..ba830e3 --- /dev/null +++ b/static.files/scrape-examples-ef1e698c1d417c0c.js @@ -0,0 +1 @@ +"use strict";(function(){const DEFAULT_MAX_LINES=5;const HIDDEN_MAX_LINES=10;function scrollToLoc(elt,loc,isHidden){const lines=elt.querySelector(".src-line-numbers");let scrollOffset;const maxLines=isHidden?HIDDEN_MAX_LINES:DEFAULT_MAX_LINES;if(loc[1]-loc[0]>maxLines){const line=Math.max(0,loc[0]-1);scrollOffset=lines.children[line].offsetTop}else{const wrapper=elt.querySelector(".code-wrapper");const halfHeight=wrapper.offsetHeight/2;const offsetTop=lines.children[loc[0]].offsetTop;const lastLine=lines.children[loc[1]];const offsetBot=lastLine.offsetTop+lastLine.offsetHeight;const offsetMid=(offsetTop+offsetBot)/2;scrollOffset=offsetMid-halfHeight}lines.scrollTo(0,scrollOffset);elt.querySelector(".rust").scrollTo(0,scrollOffset)}function updateScrapedExample(example,isHidden){const locs=JSON.parse(example.attributes.getNamedItem("data-locs").textContent);let locIndex=0;const highlights=Array.prototype.slice.call(example.querySelectorAll(".highlight"));const link=example.querySelector(".scraped-example-title a");if(locs.length>1){const onChangeLoc=changeIndex=>{removeClass(highlights[locIndex],"focus");changeIndex();scrollToLoc(example,locs[locIndex][0],isHidden);addClass(highlights[locIndex],"focus");const url=locs[locIndex][1];const title=locs[locIndex][2];link.href=url;link.innerHTML=title};example.querySelector(".prev").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex-1+locs.length)%locs.length})});example.querySelector(".next").addEventListener("click",()=>{onChangeLoc(()=>{locIndex=(locIndex+1)%locs.length})})}const expandButton=example.querySelector(".expand");if(expandButton){expandButton.addEventListener("click",()=>{if(hasClass(example,"expanded")){removeClass(example,"expanded");scrollToLoc(example,locs[0][0],isHidden)}else{addClass(example,"expanded")}})}scrollToLoc(example,locs[0][0],isHidden)}const firstExamples=document.querySelectorAll(".scraped-example-list > .scraped-example");onEachLazy(firstExamples,el=>updateScrapedExample(el,false));onEachLazy(document.querySelectorAll(".more-examples-toggle"),toggle=>{onEachLazy(toggle.querySelectorAll(".toggle-line, .hide-more"),button=>{button.addEventListener("click",()=>{toggle.open=false})});const moreExamples=toggle.querySelectorAll(".scraped-example");toggle.querySelector("summary").addEventListener("click",()=>{setTimeout(()=>{onEachLazy(moreExamples,el=>updateScrapedExample(el,true))})},{once:true})})})() \ No newline at end of file diff --git a/static.files/search-5a66c239c06b3a66.js b/static.files/search-5a66c239c06b3a66.js new file mode 100644 index 0000000..ac39292 --- /dev/null +++ b/static.files/search-5a66c239c06b3a66.js @@ -0,0 +1,5 @@ +"use strict";if(!Array.prototype.toSpliced){Array.prototype.toSpliced=function(){const me=this.slice();Array.prototype.splice.apply(me,arguments);return me}}(function(){const itemTypes=["keyword","primitive","mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","associatedtype","constant","associatedconstant","union","foreigntype","existential","attr","derive","traitalias","generic",];const longItemTypes=["keyword","primitive type","module","extern crate","re-export","struct","enum","function","type alias","static","trait","","trait method","method","struct field","enum variant","macro","assoc type","constant","assoc const","union","foreign type","existential type","attribute macro","derive macro","trait alias",];const TY_GENERIC=itemTypes.indexOf("generic");const ROOT_PATH=typeof window!=="undefined"?window.rootPath:"../";function hasOwnPropertyRustdoc(obj,property){return Object.prototype.hasOwnProperty.call(obj,property)}function printTab(nb){let iter=0;let foundCurrentTab=false;let foundCurrentResultSet=false;onEachLazy(document.getElementById("search-tabs").childNodes,elem=>{if(nb===iter){addClass(elem,"selected");foundCurrentTab=true}else{removeClass(elem,"selected")}iter+=1});const isTypeSearch=(nb>0||iter===1);iter=0;onEachLazy(document.getElementById("results").childNodes,elem=>{if(nb===iter){addClass(elem,"active");foundCurrentResultSet=true}else{removeClass(elem,"active")}iter+=1});if(foundCurrentTab&&foundCurrentResultSet){searchState.currentTab=nb;const correctionsElem=document.getElementsByClassName("search-corrections");if(isTypeSearch){removeClass(correctionsElem[0],"hidden")}else{addClass(correctionsElem[0],"hidden")}}else if(nb!==0){printTab(0)}}const editDistanceState={current:[],prev:[],prevPrev:[],calculate:function calculate(a,b,limit){if(a.lengthlimit){return limit+1}while(b.length>0&&b[0]===a[0]){a=a.substring(1);b=b.substring(1)}while(b.length>0&&b[b.length-1]===a[a.length-1]){a=a.substring(0,a.length-1);b=b.substring(0,b.length-1)}if(b.length===0){return minDist}const aLength=a.length;const bLength=b.length;for(let i=0;i<=bLength;++i){this.current[i]=0;this.prev[i]=i;this.prevPrev[i]=Number.MAX_VALUE}for(let i=1;i<=aLength;++i){this.current[0]=i;const aIdx=i-1;for(let j=1;j<=bLength;++j){const bIdx=j-1;const substitutionCost=a[aIdx]===b[bIdx]?0:1;this.current[j]=Math.min(this.prev[j]+1,this.current[j-1]+1,this.prev[j-1]+substitutionCost);if((i>1)&&(j>1)&&(a[aIdx]===b[bIdx-1])&&(a[aIdx-1]===b[bIdx])){this.current[j]=Math.min(this.current[j],this.prevPrev[j-2]+1)}}const prevPrevTmp=this.prevPrev;this.prevPrev=this.prev;this.prev=this.current;this.current=prevPrevTmp}const distance=this.prev[bLength];return distance<=limit?distance:(limit+1)},};function editDistance(a,b,limit){return editDistanceState.calculate(a,b,limit)}function initSearch(rawSearchIndex){const MAX_RESULTS=200;const NO_TYPE_FILTER=-1;let searchIndex;let currentResults;let typeNameIdMap;const ALIASES=new Map();let typeNameIdOfArray;let typeNameIdOfSlice;let typeNameIdOfArrayOrSlice;function buildTypeMapIndex(name){if(name===""||name===null){return null}if(typeNameIdMap.has(name)){return typeNameIdMap.get(name)}else{const id=typeNameIdMap.size;typeNameIdMap.set(name,id);return id}}function isSpecialStartCharacter(c){return"<\"".indexOf(c)!==-1}function isEndCharacter(c){return"=,>-]".indexOf(c)!==-1}function isStopCharacter(c){return isEndCharacter(c)}function isErrorCharacter(c){return"()".indexOf(c)!==-1}function itemTypeFromName(typename){const index=itemTypes.findIndex(i=>i===typename);if(index<0){throw["Unknown type filter ",typename]}return index}function getStringElem(query,parserState,isInGenerics){if(isInGenerics){throw["Unexpected ","\""," in generics"]}else if(query.literalSearch){throw["Cannot have more than one literal search element"]}else if(parserState.totalElems-parserState.genericsElems>0){throw["Cannot use literal search when there is more than one element"]}parserState.pos+=1;const start=parserState.pos;const end=getIdentEndPosition(parserState);if(parserState.pos>=parserState.length){throw["Unclosed ","\""]}else if(parserState.userQuery[end]!=="\""){throw["Unexpected ",parserState.userQuery[end]," in a string element"]}else if(start===end){throw["Cannot have empty string element"]}parserState.pos+=1;query.literalSearch=true}function isPathStart(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="::"}function isReturnArrow(parserState){return parserState.userQuery.slice(parserState.pos,parserState.pos+2)==="->"}function isIdentCharacter(c){return(c==="_"||(c>="0"&&c<="9")||(c>="a"&&c<="z")||(c>="A"&&c<="Z"))}function isSeparatorCharacter(c){return c===","||c==="="}function isPathSeparator(c){return c===":"||c===" "}function prevIs(parserState,lookingFor){let pos=parserState.pos;while(pos>0){const c=parserState.userQuery[pos-1];if(c===lookingFor){return true}else if(c!==" "){break}pos-=1}return false}function isLastElemGeneric(elems,parserState){return(elems.length>0&&elems[elems.length-1].generics.length>0)||prevIs(parserState,">")}function skipWhitespace(parserState){while(parserState.pos0){throw["Cannot have more than one element if you use quotes"]}const typeFilter=parserState.typeFilter;parserState.typeFilter=null;if(name==="!"){if(typeFilter!==null&&typeFilter!=="primitive"){throw["Invalid search type: primitive never type ","!"," and ",typeFilter," both specified",]}if(generics.length!==0){throw["Never type ","!"," does not accept generic parameters",]}const bindingName=parserState.isInBinding;parserState.isInBinding=null;return{name:"never",id:null,fullPath:["never"],pathWithoutLast:[],pathLast:"never",generics:[],bindings:new Map(),typeFilter:"primitive",bindingName,}}const quadcolon=/::\s*::/.exec(path);if(path.startsWith("::")){throw["Paths cannot start with ","::"]}else if(path.endsWith("::")){throw["Paths cannot end with ","::"]}else if(quadcolon!==null){throw["Unexpected ",quadcolon[0]]}const pathSegments=path.split(/(?:::\s*)|(?:\s+(?:::\s*)?)/);if(pathSegments.length===0||(pathSegments.length===1&&pathSegments[0]==="")){if(generics.length>0||prevIs(parserState,">")){throw["Found generics without a path"]}else{throw["Unexpected ",parserState.userQuery[parserState.pos]]}}for(const[i,pathSegment]of pathSegments.entries()){if(pathSegment==="!"){if(i!==0){throw["Never type ","!"," is not associated item"]}pathSegments[i]="never"}}parserState.totalElems+=1;if(isInGenerics){parserState.genericsElems+=1}const bindingName=parserState.isInBinding;parserState.isInBinding=null;const bindings=new Map();return{name:name.trim(),id:null,fullPath:pathSegments,pathWithoutLast:pathSegments.slice(0,pathSegments.length-1),pathLast:pathSegments[pathSegments.length-1],generics:generics.filter(gen=>{if(gen.bindingName!==null){bindings.set(gen.bindingName.name,[gen,...gen.bindingName.generics]);return false}return true}),bindings,typeFilter,bindingName,}}function getIdentEndPosition(parserState){const start=parserState.pos;let end=parserState.pos;let foundExclamation=-1;while(parserState.pos=end){throw["Found generics without a path"]}parserState.pos+=1;getItemsBefore(query,parserState,generics,">")}if(isStringElem){skipWhitespace(parserState)}if(start>=end&&generics.length===0){return}if(parserState.userQuery[parserState.pos]==="="){if(parserState.isInBinding){throw["Cannot write ","="," twice in a binding"]}if(!isInGenerics){throw["Type parameter ","="," must be within generics list"]}const name=parserState.userQuery.slice(start,end).trim();if(name==="!"){throw["Type parameter ","="," key cannot be ","!"," never type"]}if(name.includes("!")){throw["Type parameter ","="," key cannot be ","!"," macro"]}if(name.includes("::")){throw["Type parameter ","="," key cannot contain ","::"," path"]}if(name.includes(":")){throw["Type parameter ","="," key cannot contain ",":"," type"]}parserState.isInBinding={name,generics}}else{elems.push(createQueryElement(query,parserState,parserState.userQuery.slice(start,end),generics,isInGenerics))}}}function getItemsBefore(query,parserState,elems,endChar){let foundStopChar=true;let start=parserState.pos;const oldTypeFilter=parserState.typeFilter;parserState.typeFilter=null;const oldIsInBinding=parserState.isInBinding;parserState.isInBinding=null;let extra="";if(endChar===">"){extra="<"}else if(endChar==="]"){extra="["}else if(endChar===""){extra="->"}else{extra=endChar}while(parserState.pos"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(endChar!==""){throw["Expected ",",",", ","=",", or ",endChar,...extra,", found ",c,]}throw["Expected ",","," or ","=",...extra,", found ",c,]}const posBefore=parserState.pos;start=parserState.pos;getNextElem(query,parserState,elems,endChar!=="");if(endChar!==""&&parserState.pos>=parserState.length){throw["Unclosed ",extra]}if(posBefore===parserState.pos){parserState.pos+=1}foundStopChar=false}if(parserState.pos>=parserState.length&&endChar!==""){throw["Unclosed ",extra]}parserState.pos+=1;parserState.typeFilter=oldTypeFilter;parserState.isInBinding=oldIsInBinding}function checkExtraTypeFilterCharacters(start,parserState){const query=parserState.userQuery.slice(start,parserState.pos).trim();for(const c in query){if(!isIdentCharacter(query[c])){throw["Unexpected ",query[c]," in type filter (before ",":",")",]}}}function parseInput(query,parserState){let foundStopChar=true;let start=parserState.pos;while(parserState.pos"){if(isReturnArrow(parserState)){break}throw["Unexpected ",c," (did you mean ","->","?)"]}throw["Unexpected ",c]}else if(c===":"&&!isPathStart(parserState)){if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}else if(query.elems.length===0){throw["Expected type filter before ",":"]}else if(query.literalSearch){throw["Cannot use quotes on type filter"]}const typeFilterElem=query.elems.pop();checkExtraTypeFilterCharacters(start,parserState);parserState.typeFilter=typeFilterElem.name;parserState.pos+=1;parserState.totalElems-=1;query.literalSearch=false;foundStopChar=true;continue}else if(c===" "){skipWhitespace(parserState);continue}if(!foundStopChar){let extra="";if(isLastElemGeneric(query.elems,parserState)){extra=[" after ",">"]}else if(prevIs(parserState,"\"")){throw["Cannot have more than one element if you use quotes"]}if(parserState.typeFilter!==null){throw["Expected ",","," or ","->",...extra,", found ",c,]}throw["Expected ",",",", ",":"," or ","->",...extra,", found ",c,]}const before=query.elems.length;start=parserState.pos;getNextElem(query,parserState,query.elems,false);if(query.elems.length===before){parserState.pos+=1}foundStopChar=false}if(parserState.typeFilter!==null){throw["Unexpected ",":"," (expected path after type filter ",parserState.typeFilter+":",")",]}while(parserState.pos"]}break}else{parserState.pos+=1}}}function newParsedQuery(userQuery){return{original:userQuery,userQuery:userQuery.toLowerCase(),elems:[],returned:[],foundElems:0,totalElems:0,literalSearch:false,error:null,correction:null,proposeCorrectionFrom:null,proposeCorrectionTo:null,}}function buildUrl(search,filterCrates){let extra="?search="+encodeURIComponent(search);if(filterCrates!==null){extra+="&filter-crate="+encodeURIComponent(filterCrates)}return getNakedUrl()+extra+window.location.hash}function getFilterCrates(){const elem=document.getElementById("crate-search");if(elem&&elem.value!=="all crates"&&hasOwnPropertyRustdoc(rawSearchIndex,elem.value)){return elem.value}return null}function parseQuery(userQuery){function convertTypeFilterOnElem(elem){if(elem.typeFilter!==null){let typeFilter=elem.typeFilter;if(typeFilter==="const"){typeFilter="constant"}elem.typeFilter=itemTypeFromName(typeFilter)}else{elem.typeFilter=NO_TYPE_FILTER}for(const elem2 of elem.generics){convertTypeFilterOnElem(elem2)}for(const constraints of elem.bindings.values()){for(const constraint of constraints){convertTypeFilterOnElem(constraint)}}}userQuery=userQuery.trim().replace(/\r|\n|\t/g," ");const parserState={length:userQuery.length,pos:0,totalElems:0,genericsElems:0,typeFilter:null,isInBinding:null,userQuery:userQuery.toLowerCase(),};let query=newParsedQuery(userQuery);try{parseInput(query,parserState);for(const elem of query.elems){convertTypeFilterOnElem(elem)}for(const elem of query.returned){convertTypeFilterOnElem(elem)}}catch(err){query=newParsedQuery(userQuery);query.error=err;return query}if(!query.literalSearch){query.literalSearch=parserState.totalElems>1}query.foundElems=query.elems.length+query.returned.length;query.totalElems=parserState.totalElems;return query}function createQueryResults(results_in_args,results_returned,results_others,parsedQuery){return{"in_args":results_in_args,"returned":results_returned,"others":results_others,"query":parsedQuery,}}function execQuery(parsedQuery,searchWords,filterCrates,currentCrate){const results_others=new Map(),results_in_args=new Map(),results_returned=new Map();function transformResults(results){const duplicates=new Set();const out=[];for(const result of results){if(result.id!==-1){const obj=searchIndex[result.id];obj.dist=result.dist;const res=buildHrefAndPath(obj);obj.displayPath=pathSplitter(res[0]);obj.fullPath=obj.displayPath+obj.name;obj.fullPath+="|"+obj.ty;if(duplicates.has(obj.fullPath)){continue}duplicates.add(obj.fullPath);obj.href=res[1];out.push(obj);if(out.length>=MAX_RESULTS){break}}}return out}function sortResults(results,isType,preferredCrate){if(results.size===0){return[]}const userQuery=parsedQuery.userQuery;const result_list=[];for(const result of results.values()){result.word=searchWords[result.id];result.item=searchIndex[result.id]||{};result_list.push(result)}result_list.sort((aaa,bbb)=>{let a,b;a=(aaa.word!==userQuery);b=(bbb.word!==userQuery);if(a!==b){return a-b}a=(aaa.index<0);b=(bbb.index<0);if(a!==b){return a-b}a=aaa.path_dist;b=bbb.path_dist;if(a!==b){return a-b}a=aaa.index;b=bbb.index;if(a!==b){return a-b}a=(aaa.dist);b=(bbb.dist);if(a!==b){return a-b}a=aaa.item.deprecated;b=bbb.item.deprecated;if(a!==b){return a-b}a=(aaa.item.crate!==preferredCrate);b=(bbb.item.crate!==preferredCrate);if(a!==b){return a-b}a=aaa.word.length;b=bbb.word.length;if(a!==b){return a-b}a=aaa.word;b=bbb.word;if(a!==b){return(a>b?+1:-1)}a=(aaa.item.desc==="");b=(bbb.item.desc==="");if(a!==b){return a-b}a=aaa.item.ty;b=bbb.item.ty;if(a!==b){return a-b}a=aaa.item.path;b=bbb.item.path;if(a!==b){return(a>b?+1:-1)}return 0});let nameSplit=null;if(parsedQuery.elems.length===1){const hasPath=typeof parsedQuery.elems[0].path==="undefined";nameSplit=hasPath?null:parsedQuery.elems[0].path}for(const result of result_list){if(result.dontValidate){continue}const name=result.item.name.toLowerCase(),path=result.item.path.toLowerCase(),parent=result.item.parent;if(!isType&&!validateResult(name,path,nameSplit,parent)){result.id=-1}}return transformResults(result_list)}function unifyFunctionTypes(fnTypesIn,queryElems,whereClause,mgensIn,solutionCb){const mgens=mgensIn===null?null:new Map(mgensIn);if(queryElems.length===0){return!solutionCb||solutionCb(mgens)}if(!fnTypesIn||fnTypesIn.length===0){return false}const ql=queryElems.length;const fl=fnTypesIn.length;if(ql===1&&queryElems[0].generics.length===0&&queryElems[0].bindings.size===0){const queryElem=queryElems[0];for(const fnType of fnTypesIn){if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,whereClause,mgens)){continue}if(fnType.id<0&&queryElem.id<0){if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==queryElem.id){continue}const mgensScratch=new Map(mgens);mgensScratch.set(fnType.id,queryElem.id);if(!solutionCb||solutionCb(mgensScratch)){return true}}else if(!solutionCb||solutionCb(mgens?new Map(mgens):null)){return true}}for(const fnType of fnTypesIn){if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens)){continue}if(fnType.id<0){if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){continue}const mgensScratch=new Map(mgens);mgensScratch.set(fnType.id,0);if(unifyFunctionTypes(whereClause[(-fnType.id)-1],queryElems,whereClause,mgensScratch,solutionCb)){return true}}else if(unifyFunctionTypes(fnType.generics,queryElems,whereClause,mgens?new Map(mgens):null,solutionCb)){return true}}return false}const fnTypes=fnTypesIn.slice();const flast=fl-1;const qlast=ql-1;const queryElem=queryElems[qlast];let queryElemsTmp=null;for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsMatchCandidate(fnType,queryElem,whereClause,mgens)){continue}let mgensScratch;if(fnType.id<0){mgensScratch=new Map(mgens);if(mgensScratch.has(fnType.id)&&mgensScratch.get(fnType.id)!==queryElem.id){continue}mgensScratch.set(fnType.id,queryElem.id)}else{mgensScratch=mgens}fnTypes[i]=fnTypes[flast];fnTypes.length=flast;if(!queryElemsTmp){queryElemsTmp=queryElems.slice(0,qlast)}const passesUnification=unifyFunctionTypes(fnTypes,queryElemsTmp,whereClause,mgensScratch,mgensScratch=>{if(fnType.generics.length===0&&queryElem.generics.length===0&&fnType.bindings.size===0&&queryElem.bindings.size===0){return!solutionCb||solutionCb(mgensScratch)}const solution=unifyFunctionTypeCheckBindings(fnType,queryElem,whereClause,mgensScratch);if(!solution){return false}const simplifiedGenerics=solution.simplifiedGenerics;for(const simplifiedMgens of solution.mgens){const passesUnification=unifyFunctionTypes(simplifiedGenerics,queryElem.generics,whereClause,simplifiedMgens,solutionCb);if(passesUnification){return true}}return false});if(passesUnification){return true}fnTypes[flast]=fnTypes[i];fnTypes[i]=fnType;fnTypes.length=fl}for(let i=flast;i>=0;i-=1){const fnType=fnTypes[i];if(!unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens)){continue}let mgensScratch;if(fnType.id<0){mgensScratch=new Map(mgens);if(mgensScratch.has(fnType.id)&&mgensScratch.get(fnType.id)!==0){continue}mgensScratch.set(fnType.id,0)}else{mgensScratch=mgens}const generics=fnType.id<0?whereClause[(-fnType.id)-1]:fnType.generics;const bindings=fnType.bindings?Array.from(fnType.bindings.values()).flat():[];const passesUnification=unifyFunctionTypes(fnTypes.toSpliced(i,1,...generics,...bindings),queryElems,whereClause,mgensScratch,solutionCb);if(passesUnification){return true}}return false}function unifyFunctionTypeIsMatchCandidate(fnType,queryElem,whereClause,mgensIn){if(!typePassesFilter(queryElem.typeFilter,fnType.ty)){return false}if(fnType.id<0&&queryElem.id<0){if(mgensIn){if(mgensIn.has(fnType.id)&&mgensIn.get(fnType.id)!==queryElem.id){return false}for(const[fid,qid]of mgensIn.entries()){if(fnType.id!==fid&&queryElem.id===qid){return false}if(fnType.id===fid&&queryElem.id!==qid){return false}}}return true}else{if(queryElem.id===typeNameIdOfArrayOrSlice&&(fnType.id===typeNameIdOfSlice||fnType.id===typeNameIdOfArray)){}else if(fnType.id!==queryElem.id||queryElem.id===null){return false}if((fnType.generics.length+fnType.bindings.size)===0&&queryElem.generics.length!==0){return false}if(fnType.bindings.size0){const fnTypePath=fnType.path!==undefined&&fnType.path!==null?fnType.path.split("::"):[];if(queryElemPathLength>fnTypePath.length){return false}let i=0;for(const path of fnTypePath){if(path===queryElem.pathWithoutLast[i]){i+=1;if(i>=queryElemPathLength){break}}}if(i0){let mgensSolutionSet=[mgensIn];for(const[name,constraints]of queryElem.bindings.entries()){if(mgensSolutionSet.length===0){return false}if(!fnType.bindings.has(name)){return false}const fnTypeBindings=fnType.bindings.get(name);mgensSolutionSet=mgensSolutionSet.flatMap(mgens=>{const newSolutions=[];unifyFunctionTypes(fnTypeBindings,constraints,whereClause,mgens,newMgens=>{newSolutions.push(newMgens);return false});return newSolutions})}if(mgensSolutionSet.length===0){return false}const binds=Array.from(fnType.bindings.entries()).flatMap(entry=>{const[name,constraints]=entry;if(queryElem.bindings.has(name)){return[]}else{return constraints}});if(simplifiedGenerics.length>0){simplifiedGenerics=[...simplifiedGenerics,...binds]}else{simplifiedGenerics=binds}return{simplifiedGenerics,mgens:mgensSolutionSet}}return{simplifiedGenerics,mgens:[mgensIn]}}function unifyFunctionTypeIsUnboxCandidate(fnType,queryElem,whereClause,mgens){if(fnType.id<0&&queryElem.id>=0){if(!whereClause){return false}if(mgens&&mgens.has(fnType.id)&&mgens.get(fnType.id)!==0){return false}const mgensTmp=new Map(mgens);mgensTmp.set(fnType.id,null);return checkIfInList(whereClause[(-fnType.id)-1],queryElem,whereClause,mgensTmp)}else if(fnType.generics.length>0||fnType.bindings.size>0){const simplifiedGenerics=[...fnType.generics,...Array.from(fnType.bindings.values()).flat(),];return checkIfInList(simplifiedGenerics,queryElem,whereClause,mgens)}return false}function checkIfInList(list,elem,whereClause,mgens){for(const entry of list){if(checkType(entry,elem,whereClause,mgens)){return true}}return false}function checkType(row,elem,whereClause,mgens){if(row.bindings.size===0&&elem.bindings.size===0){if(elem.id<0){return row.id<0||checkIfInList(row.generics,elem,whereClause,mgens)}if(row.id>0&&elem.id>0&&elem.pathWithoutLast.length===0&&typePassesFilter(elem.typeFilter,row.ty)&&elem.generics.length===0&&elem.id!==typeNameIdOfArrayOrSlice){return row.id===elem.id||checkIfInList(row.generics,elem,whereClause,mgens)}}return unifyFunctionTypes([row],[elem],whereClause,mgens)}function checkPath(contains,ty,maxEditDistance){if(contains.length===0){return 0}let ret_dist=maxEditDistance+1;const path=ty.path.split("::");if(ty.parent&&ty.parent.name){path.push(ty.parent.name.toLowerCase())}const length=path.length;const clength=contains.length;pathiter:for(let i=length-clength;i>=0;i-=1){let dist_total=0;for(let x=0;xmaxEditDistance){continue pathiter}dist_total+=dist}ret_dist=Math.min(ret_dist,Math.round(dist_total/clength))}return ret_dist}function typePassesFilter(filter,type){if(filter<=NO_TYPE_FILTER||filter===type)return true;const name=itemTypes[type];switch(itemTypes[filter]){case"constant":return name==="associatedconstant";case"fn":return name==="method"||name==="tymethod";case"type":return name==="primitive"||name==="associatedtype";case"trait":return name==="traitalias"}return false}function createAliasFromItem(item){return{crate:item.crate,name:item.name,path:item.path,desc:item.desc,ty:item.ty,parent:item.parent,type:item.type,is_alias:true,deprecated:item.deprecated,implDisambiguator:item.implDisambiguator,}}function handleAliases(ret,query,filterCrates,currentCrate){const lowerQuery=query.toLowerCase();const aliases=[];const crateAliases=[];if(filterCrates!==null){if(ALIASES.has(filterCrates)&&ALIASES.get(filterCrates).has(lowerQuery)){const query_aliases=ALIASES.get(filterCrates).get(lowerQuery);for(const alias of query_aliases){aliases.push(createAliasFromItem(searchIndex[alias]))}}}else{for(const[crate,crateAliasesIndex]of ALIASES){if(crateAliasesIndex.has(lowerQuery)){const pushTo=crate===currentCrate?crateAliases:aliases;const query_aliases=crateAliasesIndex.get(lowerQuery);for(const alias of query_aliases){pushTo.push(createAliasFromItem(searchIndex[alias]))}}}}const sortFunc=(aaa,bbb)=>{if(aaa.path{alias.alias=query;const res=buildHrefAndPath(alias);alias.displayPath=pathSplitter(res[0]);alias.fullPath=alias.displayPath+alias.name;alias.href=res[1];ret.others.unshift(alias);if(ret.others.length>MAX_RESULTS){ret.others.pop()}};aliases.forEach(pushFunc);crateAliases.forEach(pushFunc)}function addIntoResults(results,fullId,id,index,dist,path_dist,maxEditDistance){const inBounds=dist<=maxEditDistance||index!==-1;if(dist===0||(!parsedQuery.literalSearch&&inBounds)){if(results.has(fullId)){const result=results.get(fullId);if(result.dontValidate||result.dist<=dist){return}}results.set(fullId,{id:id,index:index,dontValidate:parsedQuery.literalSearch,dist:dist,path_dist:path_dist,})}}function handleSingleArg(row,pos,elem,results_others,results_in_args,results_returned,maxEditDistance){if(!row||(filterCrates!==null&&row.crate!==filterCrates)){return}let index=-1,path_dist=0;const fullId=row.id;const searchWord=searchWords[pos];const in_args=row.type&&row.type.inputs&&checkIfInList(row.type.inputs,elem,row.type.where_clause);if(in_args){addIntoResults(results_in_args,fullId,pos,-1,0,0,maxEditDistance)}const returned=row.type&&row.type.output&&checkIfInList(row.type.output,elem,row.type.where_clause);if(returned){addIntoResults(results_returned,fullId,pos,-1,0,0,maxEditDistance)}if(!typePassesFilter(elem.typeFilter,row.ty)){return}const row_index=row.normalizedName.indexOf(elem.pathLast);const word_index=searchWord.indexOf(elem.pathLast);if(row_index===-1){index=word_index}else if(word_index===-1){index=row_index}else if(word_index1){path_dist=checkPath(elem.pathWithoutLast,row,maxEditDistance);if(path_dist>maxEditDistance){return}}if(parsedQuery.literalSearch){if(searchWord===elem.name){addIntoResults(results_others,fullId,pos,index,0,path_dist)}return}const dist=editDistance(searchWord,elem.pathLast,maxEditDistance);if(index===-1&&dist+path_dist>maxEditDistance){return}addIntoResults(results_others,fullId,pos,index,dist,path_dist,maxEditDistance)}function handleArgs(row,pos,results){if(!row||(filterCrates!==null&&row.crate!==filterCrates)||!row.type){return}if(!unifyFunctionTypes(row.type.inputs,parsedQuery.elems,row.type.where_clause,null,mgens=>{return unifyFunctionTypes(row.type.output,parsedQuery.returned,row.type.where_clause,mgens)})){return}addIntoResults(results,row.id,pos,0,0,0,Number.MAX_VALUE)}function innerRunQuery(){let elem,i,nSearchWords,in_returned,row;let queryLen=0;for(const elem of parsedQuery.elems){queryLen+=elem.name.length}for(const elem of parsedQuery.returned){queryLen+=elem.name.length}const maxEditDistance=Math.floor(queryLen/3);const genericSymbols=new Map();function convertNameToId(elem){if(typeNameIdMap.has(elem.pathLast)){elem.id=typeNameIdMap.get(elem.pathLast)}else if(!parsedQuery.literalSearch){let match=null;let matchDist=maxEditDistance+1;let matchName="";for(const[name,id]of typeNameIdMap){const dist=editDistance(name,elem.pathLast,maxEditDistance);if(dist<=matchDist&&dist<=maxEditDistance){if(dist===matchDist&&matchName>name){continue}match=id;matchDist=dist;matchName=name}}if(match!==null){parsedQuery.correction=matchName}elem.id=match}if((elem.id===null&&parsedQuery.totalElems>1&&elem.typeFilter===-1&&elem.generics.length===0&&elem.bindings.size===0)||elem.typeFilter===TY_GENERIC){if(genericSymbols.has(elem.name)){elem.id=genericSymbols.get(elem.name)}else{elem.id=-(genericSymbols.size+1);genericSymbols.set(elem.name,elem.id)}if(elem.typeFilter===-1&&elem.name.length>=3){const maxPartDistance=Math.floor(elem.name.length/3);let matchDist=maxPartDistance+1;let matchName="";for(const name of typeNameIdMap.keys()){const dist=editDistance(name,elem.name,maxPartDistance);if(dist<=matchDist&&dist<=maxPartDistance){if(dist===matchDist&&matchName>name){continue}matchDist=dist;matchName=name}}if(matchName!==""){parsedQuery.proposeCorrectionFrom=elem.name;parsedQuery.proposeCorrectionTo=matchName}}elem.typeFilter=TY_GENERIC}if(elem.generics.length>0&&elem.typeFilter===TY_GENERIC){parsedQuery.error=["Generic type parameter ",elem.name," does not accept generic parameters",]}for(const elem2 of elem.generics){convertNameToId(elem2)}elem.bindings=new Map(Array.from(elem.bindings.entries()).map(entry=>{const[name,constraints]=entry;if(!typeNameIdMap.has(name)){parsedQuery.error=["Type parameter ",name," does not exist",]}for(const elem2 of constraints){convertNameToId(elem2)}return[typeNameIdMap.get(name),constraints]}))}for(const elem of parsedQuery.elems){convertNameToId(elem)}for(const elem of parsedQuery.returned){convertNameToId(elem)}if(parsedQuery.foundElems===1){if(parsedQuery.elems.length===1){elem=parsedQuery.elems[0];for(i=0,nSearchWords=searchWords.length;i0){for(i=0,nSearchWords=searchWords.length;i-1||path.indexOf(key)>-1||(parent!==undefined&&parent.name!==undefined&&parent.name.toLowerCase().indexOf(key)>-1)||editDistance(name,key,maxEditDistance)<=maxEditDistance)){return false}}return true}function nextTab(direction){const next=(searchState.currentTab+direction+3)%searchState.focusedByTab.length;searchState.focusedByTab[searchState.currentTab]=document.activeElement;printTab(next);focusSearchResult()}function focusSearchResult(){const target=searchState.focusedByTab[searchState.currentTab]||document.querySelectorAll(".search-results.active a").item(0)||document.querySelectorAll("#search-tabs button").item(searchState.currentTab);searchState.focusedByTab[searchState.currentTab]=null;if(target){target.focus()}}function buildHrefAndPath(item){let displayPath;let href;const type=itemTypes[item.ty];const name=item.name;let path=item.path;if(type==="mod"){displayPath=path+"::";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+name+"/index.html"}else if(type==="import"){displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/index.html#reexport."+name}else if(type==="primitive"||type==="keyword"){displayPath="";href=ROOT_PATH+path.replace(/::/g,"/")+"/"+type+"."+name+".html"}else if(type==="externcrate"){displayPath="";href=ROOT_PATH+name+"/index.html"}else if(item.parent!==undefined){const myparent=item.parent;let anchor=type+"."+name;const parentType=itemTypes[myparent.ty];let pageType=parentType;let pageName=myparent.name;if(parentType==="primitive"){displayPath=myparent.name+"::"}else if(type==="structfield"&&parentType==="variant"){const enumNameIdx=item.path.lastIndexOf("::");const enumName=item.path.substr(enumNameIdx+2);path=item.path.substr(0,enumNameIdx);displayPath=path+"::"+enumName+"::"+myparent.name+"::";anchor="variant."+myparent.name+".field."+name;pageType="enum";pageName=enumName}else{displayPath=path+"::"+myparent.name+"::"}if(item.implDisambiguator!==null){anchor=item.implDisambiguator+"/"+anchor}href=ROOT_PATH+path.replace(/::/g,"/")+"/"+pageType+"."+pageName+".html#"+anchor}else{displayPath=item.path+"::";href=ROOT_PATH+item.path.replace(/::/g,"/")+"/"+type+"."+name+".html"}return[displayPath,href]}function pathSplitter(path){const tmp=""+path.replace(/::/g,"::");if(tmp.endsWith("")){return tmp.slice(0,tmp.length-6)}return tmp}function addTab(array,query,display){const extraClass=display?" active":"";const output=document.createElement("div");let length=0;if(array.length>0){output.className="search-results "+extraClass;array.forEach(item=>{const name=item.name;const type=itemTypes[item.ty];const longType=longItemTypes[item.ty];const typeName=longType.length!==0?`${longType}`:"?";length+=1;const link=document.createElement("a");link.className="result-"+type;link.href=item.href;const resultName=document.createElement("div");resultName.className="result-name";resultName.insertAdjacentHTML("beforeend",`${typeName}`);link.appendChild(resultName);let alias=" ";if(item.is_alias){alias=`
\ +${item.alias} - see \ +
`}resultName.insertAdjacentHTML("beforeend",`
${alias}\ +${item.displayPath}${name}\ +
`);const description=document.createElement("div");description.className="desc";description.insertAdjacentHTML("beforeend",item.desc);link.appendChild(description);output.appendChild(link)})}else if(query.error===null){output.className="search-failed"+extraClass;output.innerHTML="No results :(
"+"Try on DuckDuckGo?

"+"Or try looking in one of these:"}return[output,length]}function makeTabHeader(tabNb,text,nbElems){const fmtNbElems=nbElems<10?`\u{2007}(${nbElems})\u{2007}\u{2007}`:nbElems<100?`\u{2007}(${nbElems})\u{2007}`:`\u{2007}(${nbElems})`;if(searchState.currentTab===tabNb){return""}return""}function showResults(results,go_to_first,filterCrates){const search=searchState.outputElement();if(go_to_first||(results.others.length===1&&getSettingValue("go-to-only-result")==="true")){window.onunload=()=>{};searchState.removeQueryParameters();const elem=document.createElement("a");elem.href=results.others[0].href;removeClass(elem,"active");document.body.appendChild(elem);elem.click();return}if(results.query===undefined){results.query=parseQuery(searchState.input.value)}currentResults=results.query.userQuery;const ret_others=addTab(results.others,results.query,true);const ret_in_args=addTab(results.in_args,results.query,false);const ret_returned=addTab(results.returned,results.query,false);let currentTab=searchState.currentTab;if((currentTab===0&&ret_others[1]===0)||(currentTab===1&&ret_in_args[1]===0)||(currentTab===2&&ret_returned[1]===0)){if(ret_others[1]!==0){currentTab=0}else if(ret_in_args[1]!==0){currentTab=1}else if(ret_returned[1]!==0){currentTab=2}}let crates="";const crates_list=Object.keys(rawSearchIndex);if(crates_list.length>1){crates=" in 
"}let output=`

Results${crates}

`;if(results.query.error!==null){const error=results.query.error;error.forEach((value,index)=>{value=value.split("<").join("<").split(">").join(">");if(index%2!==0){error[index]=`${value.replaceAll(" ", " ")}`}else{error[index]=value}});output+=`

Query parser error: "${error.join("")}".

`;output+="
"+makeTabHeader(0,"In Names",ret_others[1])+"
";currentTab=0}else if(results.query.foundElems<=1&&results.query.returned.length===0){output+="
"+makeTabHeader(0,"In Names",ret_others[1])+makeTabHeader(1,"In Parameters",ret_in_args[1])+makeTabHeader(2,"In Return Types",ret_returned[1])+"
"}else{const signatureTabTitle=results.query.elems.length===0?"In Function Return Types":results.query.returned.length===0?"In Function Parameters":"In Function Signatures";output+="
"+makeTabHeader(0,signatureTabTitle,ret_others[1])+"
";currentTab=0}if(results.query.correction!==null){const orig=results.query.returned.length>0?results.query.returned[0].name:results.query.elems[0].name;output+="

"+`Type "${orig}" not found. `+"Showing results for closest type name "+`"${results.query.correction}" instead.

`}if(results.query.proposeCorrectionFrom!==null){const orig=results.query.proposeCorrectionFrom;const targ=results.query.proposeCorrectionTo;output+="

"+`Type "${orig}" not found and used as generic parameter. `+`Consider searching for "${targ}" instead.

`}const resultsElem=document.createElement("div");resultsElem.id="results";resultsElem.appendChild(ret_others[0]);resultsElem.appendChild(ret_in_args[0]);resultsElem.appendChild(ret_returned[0]);search.innerHTML=output;const crateSearch=document.getElementById("crate-search");if(crateSearch){crateSearch.addEventListener("input",updateCrate)}search.appendChild(resultsElem);searchState.showResults(search);const elems=document.getElementById("search-tabs").childNodes;searchState.focusedByTab=[];let i=0;for(const elem of elems){const j=i;elem.onclick=()=>printTab(j);searchState.focusedByTab.push(null);i+=1}printTab(currentTab)}function updateSearchHistory(url){if(!browserSupportsHistoryApi()){return}const params=searchState.getQueryStringParams();if(!history.state&&!params.search){history.pushState(null,"",url)}else{history.replaceState(null,"",url)}}function search(forced){const query=parseQuery(searchState.input.value.trim());let filterCrates=getFilterCrates();if(!forced&&query.userQuery===currentResults){if(query.userQuery.length>0){putBackSearch()}return}searchState.setLoadingSearch();const params=searchState.getQueryStringParams();if(filterCrates===null&¶ms["filter-crate"]!==undefined){filterCrates=params["filter-crate"]}searchState.title="Results for "+query.original+" - Rust";updateSearchHistory(buildUrl(query.original,filterCrates));showResults(execQuery(query,searchWords,filterCrates,window.currentCrate),params.go_to_first,filterCrates)}function buildItemSearchTypeAll(types,lowercasePaths){return types.map(type=>buildItemSearchType(type,lowercasePaths))}function buildItemSearchType(type,lowercasePaths){const PATH_INDEX_DATA=0;const GENERICS_DATA=1;const BINDINGS_DATA=2;let pathIndex,generics,bindings;if(typeof type==="number"){pathIndex=type;generics=[];bindings=new Map()}else{pathIndex=type[PATH_INDEX_DATA];generics=buildItemSearchTypeAll(type[GENERICS_DATA],lowercasePaths);if(type.length>BINDINGS_DATA){bindings=new Map(type[BINDINGS_DATA].map(binding=>{const[assocType,constraints]=binding;return[buildItemSearchType(assocType,lowercasePaths).id,buildItemSearchTypeAll(constraints,lowercasePaths),]}))}else{bindings=new Map()}}if(pathIndex<0){return{id:pathIndex,ty:TY_GENERIC,path:null,generics,bindings,}}if(pathIndex===0){return{id:null,ty:null,path:null,generics,bindings,}}const item=lowercasePaths[pathIndex-1];return{id:buildTypeMapIndex(item.name),ty:item.ty,path:item.path,generics,bindings,}}function buildFunctionSearchType(functionSearchType,lowercasePaths){const INPUTS_DATA=0;const OUTPUT_DATA=1;if(functionSearchType===0){return null}let inputs,output;if(typeof functionSearchType[INPUTS_DATA]==="number"){inputs=[buildItemSearchType(functionSearchType[INPUTS_DATA],lowercasePaths)]}else{inputs=buildItemSearchTypeAll(functionSearchType[INPUTS_DATA],lowercasePaths)}if(functionSearchType.length>1){if(typeof functionSearchType[OUTPUT_DATA]==="number"){output=[buildItemSearchType(functionSearchType[OUTPUT_DATA],lowercasePaths)]}else{output=buildItemSearchTypeAll(functionSearchType[OUTPUT_DATA],lowercasePaths)}}else{output=[]}const where_clause=[];const l=functionSearchType.length;for(let i=2;i2){path=itemPaths.has(elem[2])?itemPaths.get(elem[2]):lastPath;lastPath=path}lowercasePaths.push({ty:ty,name:name.toLowerCase(),path:path});paths[i]={ty:ty,name:name,path:path}}lastPath="";len=itemTypes.length;for(let i=0;i0?paths[itemParentIdxs[i]-1]:undefined,type:buildFunctionSearchType(itemFunctionSearchTypes[i],lowercasePaths),id:id,normalizedName:word.indexOf("_")===-1?word:word.replace(/_/g,""),deprecated:deprecatedItems.has(i),implDisambiguator:implDisambiguator.has(i)?implDisambiguator.get(i):null,};id+=1;searchIndex.push(row);lastPath=row.path;crateSize+=1}if(aliases){const currentCrateAliases=new Map();ALIASES.set(crate,currentCrateAliases);for(const alias_name in aliases){if(!hasOwnPropertyRustdoc(aliases,alias_name)){continue}let currentNameAliases;if(currentCrateAliases.has(alias_name)){currentNameAliases=currentCrateAliases.get(alias_name)}else{currentNameAliases=[];currentCrateAliases.set(alias_name,currentNameAliases)}for(const local_alias of aliases[alias_name]){currentNameAliases.push(local_alias+currentIndex)}}}currentIndex+=crateSize}return searchWords}function onSearchSubmit(e){e.preventDefault();searchState.clearInputTimeout();search()}function putBackSearch(){const search_input=searchState.input;if(!searchState.input){return}if(search_input.value!==""&&!searchState.isDisplayed()){searchState.showResults();if(browserSupportsHistoryApi()){history.replaceState(null,"",buildUrl(search_input.value,getFilterCrates()))}document.title=searchState.title}}function registerSearchEvents(){const params=searchState.getQueryStringParams();if(searchState.input.value===""){searchState.input.value=params.search||""}const searchAfter500ms=()=>{searchState.clearInputTimeout();if(searchState.input.value.length===0){searchState.hideResults()}else{searchState.timeout=setTimeout(search,500)}};searchState.input.onkeyup=searchAfter500ms;searchState.input.oninput=searchAfter500ms;document.getElementsByClassName("search-form")[0].onsubmit=onSearchSubmit;searchState.input.onchange=e=>{if(e.target!==document.activeElement){return}searchState.clearInputTimeout();setTimeout(search,0)};searchState.input.onpaste=searchState.input.onchange;searchState.outputElement().addEventListener("keydown",e=>{if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}if(e.which===38){const previous=document.activeElement.previousElementSibling;if(previous){previous.focus()}else{searchState.focus()}e.preventDefault()}else if(e.which===40){const next=document.activeElement.nextElementSibling;if(next){next.focus()}const rect=document.activeElement.getBoundingClientRect();if(window.innerHeight-rect.bottom{if(e.which===40){focusSearchResult();e.preventDefault()}});searchState.input.addEventListener("focus",()=>{putBackSearch()});searchState.input.addEventListener("blur",()=>{searchState.input.placeholder=searchState.input.origPlaceholder});if(browserSupportsHistoryApi()){const previousTitle=document.title;window.addEventListener("popstate",e=>{const params=searchState.getQueryStringParams();document.title=previousTitle;currentResults=null;if(params.search&¶ms.search.length>0){searchState.input.value=params.search;e.preventDefault();search()}else{searchState.input.value="";searchState.hideResults()}})}window.onpageshow=()=>{const qSearch=searchState.getQueryStringParams().search;if(searchState.input.value===""&&qSearch){searchState.input.value=qSearch}search()}}function updateCrate(ev){if(ev.target.value==="all crates"){const query=searchState.input.value.trim();updateSearchHistory(buildUrl(query,null))}currentResults=null;search(true)}const searchWords=buildIndex(rawSearchIndex);if(typeof window!=="undefined"){registerSearchEvents();if(window.searchState.getQueryStringParams().search){search()}}if(typeof exports!=="undefined"){exports.initSearch=initSearch;exports.execQuery=execQuery;exports.parseQuery=parseQuery}return searchWords}if(typeof window!=="undefined"){window.initSearch=initSearch;if(window.searchIndex!==undefined){initSearch(window.searchIndex)}}else{initSearch({})}})() \ No newline at end of file diff --git a/static.files/settings-fe03fdc259827cd2.js b/static.files/settings-fe03fdc259827cd2.js new file mode 100644 index 0000000..743537e --- /dev/null +++ b/static.files/settings-fe03fdc259827cd2.js @@ -0,0 +1,17 @@ +"use strict";(function(){const isSettingsPage=window.location.pathname.endsWith("/settings.html");function changeSetting(settingName,value){if(settingName==="theme"){const useSystem=value==="system preference"?"true":"false";updateLocalStorage("use-system-theme",useSystem)}updateLocalStorage(settingName,value);switch(settingName){case"theme":case"preferred-dark-theme":case"preferred-light-theme":updateTheme();updateLightAndDark();break;case"line-numbers":if(value===true){window.rustdoc_add_line_numbers_to_examples()}else{window.rustdoc_remove_line_numbers_from_examples()}break}}function showLightAndDark(){removeClass(document.getElementById("preferred-light-theme"),"hidden");removeClass(document.getElementById("preferred-dark-theme"),"hidden")}function hideLightAndDark(){addClass(document.getElementById("preferred-light-theme"),"hidden");addClass(document.getElementById("preferred-dark-theme"),"hidden")}function updateLightAndDark(){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||(useSystem===null&&getSettingValue("theme")===null)){showLightAndDark()}else{hideLightAndDark()}}function setEvents(settingsElement){updateLightAndDark();onEachLazy(settingsElement.querySelectorAll("input[type=\"checkbox\"]"),toggle=>{const settingId=toggle.id;const settingValue=getSettingValue(settingId);if(settingValue!==null){toggle.checked=settingValue==="true"}toggle.onchange=()=>{changeSetting(toggle.id,toggle.checked)}});onEachLazy(settingsElement.querySelectorAll("input[type=\"radio\"]"),elem=>{const settingId=elem.name;let settingValue=getSettingValue(settingId);if(settingId==="theme"){const useSystem=getSettingValue("use-system-theme");if(useSystem==="true"||settingValue===null){settingValue=useSystem==="false"?"light":"system preference"}}if(settingValue!==null&&settingValue!=="null"){elem.checked=settingValue===elem.value}elem.addEventListener("change",ev=>{changeSetting(ev.target.name,ev.target.value)})})}function buildSettingsPageSections(settings){let output="";for(const setting of settings){const js_data_name=setting["js_name"];const setting_name=setting["name"];if(setting["options"]!==undefined){output+=`\ +
+
${setting_name}
+
`;onEach(setting["options"],option=>{const checked=option===setting["default"]?" checked":"";const full=`${js_data_name}-${option.replace(/ /g,"-")}`;output+=`\ + `});output+=`\ +
+
`}else{const checked=setting["default"]===true?" checked":"";output+=`\ +
\ + \ +
`}}return output}function buildSettingsPage(){const theme_names=getVar("themes").split(",").filter(t=>t);theme_names.push("light","dark","ayu");const settings=[{"name":"Theme","js_name":"theme","default":"system preference","options":theme_names.concat("system preference"),},{"name":"Preferred light theme","js_name":"preferred-light-theme","default":"light","options":theme_names,},{"name":"Preferred dark theme","js_name":"preferred-dark-theme","default":"dark","options":theme_names,},{"name":"Auto-hide item contents for large items","js_name":"auto-hide-large-items","default":true,},{"name":"Auto-hide item methods' documentation","js_name":"auto-hide-method-docs","default":false,},{"name":"Auto-hide trait implementation documentation","js_name":"auto-hide-trait-implementations","default":false,},{"name":"Directly go to item in search if there is only one result","js_name":"go-to-only-result","default":false,},{"name":"Show line numbers on code examples","js_name":"line-numbers","default":false,},{"name":"Disable keyboard shortcuts","js_name":"disable-shortcuts","default":false,},];const elementKind=isSettingsPage?"section":"div";const innerHTML=`
${buildSettingsPageSections(settings)}
`;const el=document.createElement(elementKind);el.id="settings";if(!isSettingsPage){el.className="popover"}el.innerHTML=innerHTML;if(isSettingsPage){document.getElementById(MAIN_ID).appendChild(el)}else{el.setAttribute("tabindex","-1");getSettingsButton().appendChild(el)}return el}const settingsMenu=buildSettingsPage();function displaySettings(){settingsMenu.style.display=""}function settingsBlurHandler(event){blurHandler(event,getSettingsButton(),window.hidePopoverMenus)}if(isSettingsPage){getSettingsButton().onclick=event=>{event.preventDefault()}}else{const settingsButton=getSettingsButton();const settingsMenu=document.getElementById("settings");settingsButton.onclick=event=>{if(settingsMenu.contains(event.target)){return}event.preventDefault();const shouldDisplaySettings=settingsMenu.style.display==="none";window.hideAllModals();if(shouldDisplaySettings){displaySettings()}};settingsButton.onblur=settingsBlurHandler;settingsButton.querySelector("a").onblur=settingsBlurHandler;onEachLazy(settingsMenu.querySelectorAll("input"),el=>{el.onblur=settingsBlurHandler});settingsMenu.onblur=settingsBlurHandler}setTimeout(()=>{setEvents(settingsMenu);if(!isSettingsPage){displaySettings()}removeClass(getSettingsButton(),"rotate")},0)})() \ No newline at end of file diff --git a/static.files/src-script-3280b574d94e47b4.js b/static.files/src-script-3280b574d94e47b4.js new file mode 100644 index 0000000..9ea8892 --- /dev/null +++ b/static.files/src-script-3280b574d94e47b4.js @@ -0,0 +1 @@ +"use strict";(function(){const rootPath=getVar("root-path");const NAME_OFFSET=0;const DIRS_OFFSET=1;const FILES_OFFSET=2;const RUSTDOC_MOBILE_BREAKPOINT=700;function closeSidebarIfMobile(){if(window.innerWidth"){addClass(document.documentElement,"src-sidebar-expanded");child.innerText="<";updateLocalStorage("source-sidebar-show","true")}else{removeClass(document.documentElement,"src-sidebar-expanded");child.innerText=">";updateLocalStorage("source-sidebar-show","false")}}function createSidebarToggle(){const sidebarToggle=document.createElement("div");sidebarToggle.id="src-sidebar-toggle";const inner=document.createElement("button");if(getCurrentValue("source-sidebar-show")==="true"){inner.innerText="<"}else{inner.innerText=">"}inner.onclick=toggleSidebar;sidebarToggle.appendChild(inner);return sidebarToggle}function createSrcSidebar(){const container=document.querySelector("nav.sidebar");const sidebarToggle=createSidebarToggle();container.insertBefore(sidebarToggle,container.firstChild);const sidebar=document.createElement("div");sidebar.id="src-sidebar";let hasFoundFile=false;const title=document.createElement("div");title.className="title";title.innerText="Files";sidebar.appendChild(title);Object.keys(srcIndex).forEach(key=>{srcIndex[key][NAME_OFFSET]=key;hasFoundFile=createDirEntry(srcIndex[key],sidebar,"",hasFoundFile)});container.appendChild(sidebar);const selected_elem=sidebar.getElementsByClassName("selected")[0];if(typeof selected_elem!=="undefined"){selected_elem.focus()}}const lineNumbersRegex=/^#?(\d+)(?:-(\d+))?$/;function highlightSrcLines(match){if(typeof match==="undefined"){match=window.location.hash.match(lineNumbersRegex)}if(!match){return}let from=parseInt(match[1],10);let to=from;if(typeof match[2]!=="undefined"){to=parseInt(match[2],10)}if(to{onEachLazy(e.getElementsByTagName("a"),i_e=>{removeClass(i_e,"line-highlighted")})});for(let i=from;i<=to;++i){elem=document.getElementById(i);if(!elem){break}addClass(elem,"line-highlighted")}}const handleSrcHighlight=(function(){let prev_line_id=0;const set_fragment=name=>{const x=window.scrollX,y=window.scrollY;if(browserSupportsHistoryApi()){history.replaceState(null,null,"#"+name);highlightSrcLines()}else{location.replace("#"+name)}window.scrollTo(x,y)};return ev=>{let cur_line_id=parseInt(ev.target.id,10);if(isNaN(cur_line_id)||ev.ctrlKey||ev.altKey||ev.metaKey){return}ev.preventDefault();if(ev.shiftKey&&prev_line_id){if(prev_line_id>cur_line_id){const tmp=prev_line_id;prev_line_id=cur_line_id;cur_line_id=tmp}set_fragment(prev_line_id+"-"+cur_line_id)}else{prev_line_id=cur_line_id;set_fragment(cur_line_id)}}}());window.addEventListener("hashchange",()=>{const match=window.location.hash.match(lineNumbersRegex);if(match){return highlightSrcLines(match)}});onEachLazy(document.getElementsByClassName("src-line-numbers"),el=>{el.addEventListener("click",handleSrcHighlight)});highlightSrcLines();window.createSrcSidebar=createSrcSidebar})() \ No newline at end of file diff --git a/static.files/storage-fec3eaa3851e447d.js b/static.files/storage-fec3eaa3851e447d.js new file mode 100644 index 0000000..a687118 --- /dev/null +++ b/static.files/storage-fec3eaa3851e447d.js @@ -0,0 +1 @@ +"use strict";const builtinThemes=["light","dark","ayu"];const darkThemes=["dark","ayu"];window.currentTheme=document.getElementById("themeStyle");const settingsDataset=(function(){const settingsElement=document.getElementById("default-settings");return settingsElement&&settingsElement.dataset?settingsElement.dataset:null})();function getSettingValue(settingName){const current=getCurrentValue(settingName);if(current===null&&settingsDataset!==null){const def=settingsDataset[settingName.replace(/-/g,"_")];if(def!==undefined){return def}}return current}const localStoredTheme=getSettingValue("theme");function hasClass(elem,className){return elem&&elem.classList&&elem.classList.contains(className)}function addClass(elem,className){if(elem&&elem.classList){elem.classList.add(className)}}function removeClass(elem,className){if(elem&&elem.classList){elem.classList.remove(className)}}function onEach(arr,func,reversed){if(arr&&arr.length>0){if(reversed){for(let i=arr.length-1;i>=0;--i){if(func(arr[i])){return true}}}else{for(const elem of arr){if(func(elem)){return true}}}}return false}function onEachLazy(lazyArray,func,reversed){return onEach(Array.prototype.slice.call(lazyArray),func,reversed)}function updateLocalStorage(name,value){try{window.localStorage.setItem("rustdoc-"+name,value)}catch(e){}}function getCurrentValue(name){try{return window.localStorage.getItem("rustdoc-"+name)}catch(e){return null}}const getVar=(function getVar(name){const el=document.querySelector("head > meta[name='rustdoc-vars']");return el?el.attributes["data-"+name].value:null});function switchTheme(newThemeName,saveTheme){if(saveTheme){updateLocalStorage("theme",newThemeName)}document.documentElement.setAttribute("data-theme",newThemeName);if(builtinThemes.indexOf(newThemeName)!==-1){if(window.currentTheme){window.currentTheme.parentNode.removeChild(window.currentTheme);window.currentTheme=null}}else{const newHref=getVar("root-path")+newThemeName+getVar("resource-suffix")+".css";if(!window.currentTheme){if(document.readyState==="loading"){document.write(``);window.currentTheme=document.getElementById("themeStyle")}else{window.currentTheme=document.createElement("link");window.currentTheme.rel="stylesheet";window.currentTheme.id="themeStyle";window.currentTheme.href=newHref;document.documentElement.appendChild(window.currentTheme)}}else if(newHref!==window.currentTheme.href){window.currentTheme.href=newHref}}}const updateTheme=(function(){const mql=window.matchMedia("(prefers-color-scheme: dark)");function updateTheme(){if(getSettingValue("use-system-theme")!=="false"){const lightTheme=getSettingValue("preferred-light-theme")||"light";const darkTheme=getSettingValue("preferred-dark-theme")||"dark";updateLocalStorage("use-system-theme","true");switchTheme(mql.matches?darkTheme:lightTheme,true)}else{switchTheme(getSettingValue("theme"),false)}}mql.addEventListener("change",updateTheme);return updateTheme})();if(getSettingValue("use-system-theme")!=="false"&&window.matchMedia){if(getSettingValue("use-system-theme")===null&&getSettingValue("preferred-dark-theme")===null&&darkThemes.indexOf(localStoredTheme)>=0){updateLocalStorage("preferred-dark-theme",localStoredTheme)}}updateTheme();if(getSettingValue("source-sidebar-show")==="true"){addClass(document.documentElement,"src-sidebar-expanded")}window.addEventListener("pageshow",ev=>{if(ev.persisted){setTimeout(updateTheme,0)}}) \ No newline at end of file diff --git a/static.files/wheel-7b819b6101059cd0.svg b/static.files/wheel-7b819b6101059cd0.svg new file mode 100644 index 0000000..83c07f6 --- /dev/null +++ b/static.files/wheel-7b819b6101059cd0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/trait.impl/bitflags/traits/trait.Flags.js b/trait.impl/bitflags/traits/trait.Flags.js new file mode 100644 index 0000000..62c26a0 --- /dev/null +++ b/trait.impl/bitflags/traits/trait.Flags.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Flags for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/bitflags/traits/trait.PublicFlags.js b/trait.impl/bitflags/traits/trait.PublicFlags.js new file mode 100644 index 0000000..5c6a199 --- /dev/null +++ b/trait.impl/bitflags/traits/trait.PublicFlags.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl PublicFlags for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/clone/trait.Clone.js b/trait.impl/core/clone/trait.Clone.js new file mode 100644 index 0000000..310c7c7 --- /dev/null +++ b/trait.impl/core/clone/trait.Clone.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Clone for PageTable"],["impl Clone for PhysPage"],["impl Clone for TrapType"],["impl Clone for VirtAddr"],["impl Clone for PhysAddr"],["impl Clone for MappingFlags"],["impl Clone for VirtPage"],["impl Clone for Time"],["impl Clone for TrapFrame"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/cmp/trait.Eq.js b/trait.impl/core/cmp/trait.Eq.js new file mode 100644 index 0000000..790af1a --- /dev/null +++ b/trait.impl/core/cmp/trait.Eq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Eq for VirtAddr"],["impl Eq for MappingFlags"],["impl Eq for VirtPage"],["impl Eq for PhysAddr"],["impl Eq for PhysPage"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/cmp/trait.Ord.js b/trait.impl/core/cmp/trait.Ord.js new file mode 100644 index 0000000..d3fd2fd --- /dev/null +++ b/trait.impl/core/cmp/trait.Ord.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Ord for VirtAddr"],["impl Ord for PhysAddr"],["impl Ord for VirtPage"],["impl Ord for PhysPage"],["impl Ord for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/cmp/trait.PartialEq.js b/trait.impl/core/cmp/trait.PartialEq.js new file mode 100644 index 0000000..3302a8b --- /dev/null +++ b/trait.impl/core/cmp/trait.PartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl PartialEq for PhysAddr"],["impl PartialEq for VirtAddr"],["impl PartialEq for MappingFlags"],["impl PartialEq for VirtPage"],["impl PartialEq for PhysPage"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/cmp/trait.PartialOrd.js b/trait.impl/core/cmp/trait.PartialOrd.js new file mode 100644 index 0000000..8708317 --- /dev/null +++ b/trait.impl/core/cmp/trait.PartialOrd.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl PartialOrd for PhysAddr"],["impl PartialOrd for PhysPage"],["impl PartialOrd for MappingFlags"],["impl PartialOrd for VirtPage"],["impl PartialOrd for VirtAddr"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/convert/trait.From.js b/trait.impl/core/convert/trait.From.js new file mode 100644 index 0000000..44eee74 --- /dev/null +++ b/trait.impl/core/convert/trait.From.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl From<VirtAddr> for usize"],["impl From<PhysAddr> for PhysPage"],["impl From<PhysPage> for PhysAddr"],["impl From<usize> for PhysPage"],["impl From<usize> for VirtPage"],["impl From<VirtAddr> for VirtPage"],["impl From<PhysPage> for usize"],["impl From<VirtPage> for VirtAddr"],["impl From<usize> for VirtAddr"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.Binary.js b/trait.impl/core/fmt/trait.Binary.js new file mode 100644 index 0000000..616806e --- /dev/null +++ b/trait.impl/core/fmt/trait.Binary.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Binary for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.Debug.js b/trait.impl/core/fmt/trait.Debug.js new file mode 100644 index 0000000..48fc461 --- /dev/null +++ b/trait.impl/core/fmt/trait.Debug.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Debug for KContextArgs"],["impl<T: Debug> Debug for LazyInit<T>"],["impl Debug for PageTableWrapper"],["impl Debug for VirtAddr"],["impl Debug for PhysAddr"],["impl Debug for TrapType"],["impl Debug for VirtPage"],["impl Debug for TrapFrame"],["impl Debug for PhysPage"],["impl Debug for Time"],["impl Debug for KContext"],["impl Debug for PageTable"],["impl Debug for MappingFlags"],["impl Debug for TrapFrameArgs"],["impl Debug for MappingSize"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.Display.js b/trait.impl/core/fmt/trait.Display.js new file mode 100644 index 0000000..29a45f3 --- /dev/null +++ b/trait.impl/core/fmt/trait.Display.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Display for VirtAddr"],["impl Display for PhysPage"],["impl Display for PhysAddr"],["impl Display for VirtPage"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.LowerHex.js b/trait.impl/core/fmt/trait.LowerHex.js new file mode 100644 index 0000000..5113efa --- /dev/null +++ b/trait.impl/core/fmt/trait.LowerHex.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl LowerHex for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.Octal.js b/trait.impl/core/fmt/trait.Octal.js new file mode 100644 index 0000000..a3a22a5 --- /dev/null +++ b/trait.impl/core/fmt/trait.Octal.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Octal for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.UpperHex.js b/trait.impl/core/fmt/trait.UpperHex.js new file mode 100644 index 0000000..1c03a49 --- /dev/null +++ b/trait.impl/core/fmt/trait.UpperHex.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl UpperHex for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/fmt/trait.Write.js b/trait.impl/core/fmt/trait.Write.js new file mode 100644 index 0000000..40602c5 --- /dev/null +++ b/trait.impl/core/fmt/trait.Write.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Write for DebugConsole"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/hash/trait.Hash.js b/trait.impl/core/hash/trait.Hash.js new file mode 100644 index 0000000..c225664 --- /dev/null +++ b/trait.impl/core/hash/trait.Hash.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Hash for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/iter/traits/collect/trait.Extend.js b/trait.impl/core/iter/traits/collect/trait.Extend.js new file mode 100644 index 0000000..be4bf42 --- /dev/null +++ b/trait.impl/core/iter/traits/collect/trait.Extend.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Extend<MappingFlags> for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/iter/traits/collect/trait.FromIterator.js b/trait.impl/core/iter/traits/collect/trait.FromIterator.js new file mode 100644 index 0000000..6619520 --- /dev/null +++ b/trait.impl/core/iter/traits/collect/trait.FromIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl FromIterator<MappingFlags> for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/iter/traits/collect/trait.IntoIterator.js b/trait.impl/core/iter/traits/collect/trait.IntoIterator.js new file mode 100644 index 0000000..7660639 --- /dev/null +++ b/trait.impl/core/iter/traits/collect/trait.IntoIterator.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl IntoIterator for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Copy.js b/trait.impl/core/marker/trait.Copy.js new file mode 100644 index 0000000..b1e45aa --- /dev/null +++ b/trait.impl/core/marker/trait.Copy.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Copy for PhysPage"],["impl Copy for MappingFlags"],["impl Copy for Time"],["impl Copy for PageTable"],["impl Copy for TrapType"],["impl Copy for VirtPage"],["impl Copy for PhysAddr"],["impl Copy for VirtAddr"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Freeze.js b/trait.impl/core/marker/trait.Freeze.js new file mode 100644 index 0000000..96f7e8b --- /dev/null +++ b/trait.impl/core/marker/trait.Freeze.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Freeze for PhysAddr",1,["polyhal::addr::PhysAddr"]],["impl Freeze for VirtAddr",1,["polyhal::addr::VirtAddr"]],["impl Freeze for PhysPage",1,["polyhal::addr::PhysPage"]],["impl Freeze for VirtPage",1,["polyhal::addr::VirtPage"]],["impl Freeze for DebugConsole",1,["polyhal::debug::DebugConsole"]],["impl Freeze for Instruction",1,["polyhal::instruction::Instruction"]],["impl Freeze for IRQ",1,["polyhal::irq::IRQ"]],["impl Freeze for Barrier",1,["polyhal::mem::Barrier"]],["impl Freeze for MultiCore",1,["polyhal::multicore::MultiCore"]],["impl<T> !Freeze for LazyInit<T>",1,["polyhal::once::LazyInit"]],["impl Freeze for MappingFlags",1,["polyhal::pagetable::MappingFlags"]],["impl Freeze for MappingSize",1,["polyhal::pagetable::MappingSize"]],["impl Freeze for PageTable",1,["polyhal::pagetable::PageTable"]],["impl Freeze for TLB",1,["polyhal::pagetable::TLB"]],["impl Freeze for PageTableWrapper",1,["polyhal::pagetable::PageTableWrapper"]],["impl Freeze for Time",1,["polyhal::time::Time"]],["impl Freeze for TrapFrame",1,["polyhal::currrent_arch::context::TrapFrame"]],["impl Freeze for KContext",1,["polyhal::currrent_arch::kcontext::KContext"]],["impl Freeze for KContextArgs",1,["polyhal::KContextArgs"]],["impl Freeze for TrapFrameArgs",1,["polyhal::TrapFrameArgs"]],["impl Freeze for TrapType",1,["polyhal::TrapType"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Send.js b/trait.impl/core/marker/trait.Send.js new file mode 100644 index 0000000..e3f7e10 --- /dev/null +++ b/trait.impl/core/marker/trait.Send.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Send for PhysAddr",1,["polyhal::addr::PhysAddr"]],["impl Send for VirtAddr",1,["polyhal::addr::VirtAddr"]],["impl Send for PhysPage",1,["polyhal::addr::PhysPage"]],["impl Send for VirtPage",1,["polyhal::addr::VirtPage"]],["impl Send for DebugConsole",1,["polyhal::debug::DebugConsole"]],["impl Send for Instruction",1,["polyhal::instruction::Instruction"]],["impl Send for IRQ",1,["polyhal::irq::IRQ"]],["impl Send for Barrier",1,["polyhal::mem::Barrier"]],["impl Send for MultiCore",1,["polyhal::multicore::MultiCore"]],["impl Send for MappingFlags",1,["polyhal::pagetable::MappingFlags"]],["impl Send for MappingSize",1,["polyhal::pagetable::MappingSize"]],["impl Send for PageTable",1,["polyhal::pagetable::PageTable"]],["impl Send for TLB",1,["polyhal::pagetable::TLB"]],["impl Send for PageTableWrapper",1,["polyhal::pagetable::PageTableWrapper"]],["impl Send for Time",1,["polyhal::time::Time"]],["impl Send for TrapFrame",1,["polyhal::currrent_arch::context::TrapFrame"]],["impl Send for KContext",1,["polyhal::currrent_arch::kcontext::KContext"]],["impl Send for KContextArgs",1,["polyhal::KContextArgs"]],["impl Send for TrapFrameArgs",1,["polyhal::TrapFrameArgs"]],["impl Send for TrapType",1,["polyhal::TrapType"]],["impl<T: Send> Send for LazyInit<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.StructuralEq.js b/trait.impl/core/marker/trait.StructuralEq.js new file mode 100644 index 0000000..bc4fe66 --- /dev/null +++ b/trait.impl/core/marker/trait.StructuralEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl StructuralEq for VirtPage"],["impl StructuralEq for PhysPage"],["impl StructuralEq for PhysAddr"],["impl StructuralEq for VirtAddr"],["impl StructuralEq for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.StructuralPartialEq.js b/trait.impl/core/marker/trait.StructuralPartialEq.js new file mode 100644 index 0000000..de6121c --- /dev/null +++ b/trait.impl/core/marker/trait.StructuralPartialEq.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl StructuralPartialEq for MappingFlags"],["impl StructuralPartialEq for PhysPage"],["impl StructuralPartialEq for VirtPage"],["impl StructuralPartialEq for PhysAddr"],["impl StructuralPartialEq for VirtAddr"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Sync.js b/trait.impl/core/marker/trait.Sync.js new file mode 100644 index 0000000..2f3afc0 --- /dev/null +++ b/trait.impl/core/marker/trait.Sync.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Sync for PhysAddr",1,["polyhal::addr::PhysAddr"]],["impl Sync for VirtAddr",1,["polyhal::addr::VirtAddr"]],["impl Sync for PhysPage",1,["polyhal::addr::PhysPage"]],["impl Sync for VirtPage",1,["polyhal::addr::VirtPage"]],["impl Sync for DebugConsole",1,["polyhal::debug::DebugConsole"]],["impl Sync for Instruction",1,["polyhal::instruction::Instruction"]],["impl Sync for IRQ",1,["polyhal::irq::IRQ"]],["impl Sync for Barrier",1,["polyhal::mem::Barrier"]],["impl Sync for MultiCore",1,["polyhal::multicore::MultiCore"]],["impl Sync for MappingFlags",1,["polyhal::pagetable::MappingFlags"]],["impl Sync for MappingSize",1,["polyhal::pagetable::MappingSize"]],["impl Sync for PageTable",1,["polyhal::pagetable::PageTable"]],["impl Sync for TLB",1,["polyhal::pagetable::TLB"]],["impl Sync for PageTableWrapper",1,["polyhal::pagetable::PageTableWrapper"]],["impl Sync for Time",1,["polyhal::time::Time"]],["impl Sync for TrapFrame",1,["polyhal::currrent_arch::context::TrapFrame"]],["impl Sync for KContext",1,["polyhal::currrent_arch::kcontext::KContext"]],["impl Sync for KContextArgs",1,["polyhal::KContextArgs"]],["impl Sync for TrapFrameArgs",1,["polyhal::TrapFrameArgs"]],["impl Sync for TrapType",1,["polyhal::TrapType"]],["impl<T: Send + Sync> Sync for LazyInit<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/marker/trait.Unpin.js b/trait.impl/core/marker/trait.Unpin.js new file mode 100644 index 0000000..5f768ec --- /dev/null +++ b/trait.impl/core/marker/trait.Unpin.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Unpin for PhysAddr",1,["polyhal::addr::PhysAddr"]],["impl Unpin for VirtAddr",1,["polyhal::addr::VirtAddr"]],["impl Unpin for PhysPage",1,["polyhal::addr::PhysPage"]],["impl Unpin for VirtPage",1,["polyhal::addr::VirtPage"]],["impl Unpin for DebugConsole",1,["polyhal::debug::DebugConsole"]],["impl Unpin for Instruction",1,["polyhal::instruction::Instruction"]],["impl Unpin for IRQ",1,["polyhal::irq::IRQ"]],["impl Unpin for Barrier",1,["polyhal::mem::Barrier"]],["impl Unpin for MultiCore",1,["polyhal::multicore::MultiCore"]],["impl<T> Unpin for LazyInit<T>where\n T: Unpin,",1,["polyhal::once::LazyInit"]],["impl Unpin for MappingFlags",1,["polyhal::pagetable::MappingFlags"]],["impl Unpin for MappingSize",1,["polyhal::pagetable::MappingSize"]],["impl Unpin for PageTable",1,["polyhal::pagetable::PageTable"]],["impl Unpin for TLB",1,["polyhal::pagetable::TLB"]],["impl Unpin for PageTableWrapper",1,["polyhal::pagetable::PageTableWrapper"]],["impl Unpin for Time",1,["polyhal::time::Time"]],["impl Unpin for TrapFrame",1,["polyhal::currrent_arch::context::TrapFrame"]],["impl Unpin for KContext",1,["polyhal::currrent_arch::kcontext::KContext"]],["impl Unpin for KContextArgs",1,["polyhal::KContextArgs"]],["impl Unpin for TrapFrameArgs",1,["polyhal::TrapFrameArgs"]],["impl Unpin for TrapType",1,["polyhal::TrapType"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/arith/trait.Add.js b/trait.impl/core/ops/arith/trait.Add.js new file mode 100644 index 0000000..d19a827 --- /dev/null +++ b/trait.impl/core/ops/arith/trait.Add.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Add<usize> for VirtPage"],["impl Add<usize> for PhysPage"],["impl Add for PhysPage"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/arith/trait.Sub.js b/trait.impl/core/ops/arith/trait.Sub.js new file mode 100644 index 0000000..2201222 --- /dev/null +++ b/trait.impl/core/ops/arith/trait.Sub.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Sub for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/arith/trait.SubAssign.js b/trait.impl/core/ops/arith/trait.SubAssign.js new file mode 100644 index 0000000..57b6240 --- /dev/null +++ b/trait.impl/core/ops/arith/trait.SubAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl SubAssign for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/bit/trait.BitAnd.js b/trait.impl/core/ops/bit/trait.BitAnd.js new file mode 100644 index 0000000..67cf334 --- /dev/null +++ b/trait.impl/core/ops/bit/trait.BitAnd.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl BitAnd for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/bit/trait.BitAndAssign.js b/trait.impl/core/ops/bit/trait.BitAndAssign.js new file mode 100644 index 0000000..35b46b5 --- /dev/null +++ b/trait.impl/core/ops/bit/trait.BitAndAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl BitAndAssign for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/bit/trait.BitOr.js b/trait.impl/core/ops/bit/trait.BitOr.js new file mode 100644 index 0000000..4c90636 --- /dev/null +++ b/trait.impl/core/ops/bit/trait.BitOr.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl BitOr for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/bit/trait.BitOrAssign.js b/trait.impl/core/ops/bit/trait.BitOrAssign.js new file mode 100644 index 0000000..6bfca49 --- /dev/null +++ b/trait.impl/core/ops/bit/trait.BitOrAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl BitOrAssign for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/bit/trait.BitXor.js b/trait.impl/core/ops/bit/trait.BitXor.js new file mode 100644 index 0000000..73162a7 --- /dev/null +++ b/trait.impl/core/ops/bit/trait.BitXor.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl BitXor for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/bit/trait.BitXorAssign.js b/trait.impl/core/ops/bit/trait.BitXorAssign.js new file mode 100644 index 0000000..d5fc842 --- /dev/null +++ b/trait.impl/core/ops/bit/trait.BitXorAssign.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl BitXorAssign for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/bit/trait.Not.js b/trait.impl/core/ops/bit/trait.Not.js new file mode 100644 index 0000000..6f81f5c --- /dev/null +++ b/trait.impl/core/ops/bit/trait.Not.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Not for MappingFlags"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/deref/trait.Deref.js b/trait.impl/core/ops/deref/trait.Deref.js new file mode 100644 index 0000000..2d3dab1 --- /dev/null +++ b/trait.impl/core/ops/deref/trait.Deref.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Deref for PageTableWrapper"],["impl<T> Deref for LazyInit<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/deref/trait.DerefMut.js b/trait.impl/core/ops/deref/trait.DerefMut.js new file mode 100644 index 0000000..60e6c04 --- /dev/null +++ b/trait.impl/core/ops/deref/trait.DerefMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl<T> DerefMut for LazyInit<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/drop/trait.Drop.js b/trait.impl/core/ops/drop/trait.Drop.js new file mode 100644 index 0000000..99a9b86 --- /dev/null +++ b/trait.impl/core/ops/drop/trait.Drop.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Drop for PageTableWrapper"],["impl<T> Drop for LazyInit<T>"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/index/trait.Index.js b/trait.impl/core/ops/index/trait.Index.js new file mode 100644 index 0000000..803ccc2 --- /dev/null +++ b/trait.impl/core/ops/index/trait.Index.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl Index<TrapFrameArgs> for TrapFrame"],["impl Index<KContextArgs> for KContext"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/ops/index/trait.IndexMut.js b/trait.impl/core/ops/index/trait.IndexMut.js new file mode 100644 index 0000000..ce00409 --- /dev/null +++ b/trait.impl/core/ops/index/trait.IndexMut.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl IndexMut<TrapFrameArgs> for TrapFrame"],["impl IndexMut<KContextArgs> for KContext"]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js b/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js new file mode 100644 index 0000000..b60045b --- /dev/null +++ b/trait.impl/core/panic/unwind_safe/trait.RefUnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl RefUnwindSafe for PhysAddr",1,["polyhal::addr::PhysAddr"]],["impl RefUnwindSafe for VirtAddr",1,["polyhal::addr::VirtAddr"]],["impl RefUnwindSafe for PhysPage",1,["polyhal::addr::PhysPage"]],["impl RefUnwindSafe for VirtPage",1,["polyhal::addr::VirtPage"]],["impl RefUnwindSafe for DebugConsole",1,["polyhal::debug::DebugConsole"]],["impl RefUnwindSafe for Instruction",1,["polyhal::instruction::Instruction"]],["impl RefUnwindSafe for IRQ",1,["polyhal::irq::IRQ"]],["impl RefUnwindSafe for Barrier",1,["polyhal::mem::Barrier"]],["impl RefUnwindSafe for MultiCore",1,["polyhal::multicore::MultiCore"]],["impl<T> !RefUnwindSafe for LazyInit<T>",1,["polyhal::once::LazyInit"]],["impl RefUnwindSafe for MappingFlags",1,["polyhal::pagetable::MappingFlags"]],["impl RefUnwindSafe for MappingSize",1,["polyhal::pagetable::MappingSize"]],["impl RefUnwindSafe for PageTable",1,["polyhal::pagetable::PageTable"]],["impl RefUnwindSafe for TLB",1,["polyhal::pagetable::TLB"]],["impl RefUnwindSafe for PageTableWrapper",1,["polyhal::pagetable::PageTableWrapper"]],["impl RefUnwindSafe for Time",1,["polyhal::time::Time"]],["impl RefUnwindSafe for TrapFrame",1,["polyhal::currrent_arch::context::TrapFrame"]],["impl RefUnwindSafe for KContext",1,["polyhal::currrent_arch::kcontext::KContext"]],["impl RefUnwindSafe for KContextArgs",1,["polyhal::KContextArgs"]],["impl RefUnwindSafe for TrapFrameArgs",1,["polyhal::TrapFrameArgs"]],["impl RefUnwindSafe for TrapType",1,["polyhal::TrapType"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file diff --git a/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js b/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js new file mode 100644 index 0000000..1485ee4 --- /dev/null +++ b/trait.impl/core/panic/unwind_safe/trait.UnwindSafe.js @@ -0,0 +1,3 @@ +(function() {var implementors = { +"polyhal":[["impl UnwindSafe for PhysAddr",1,["polyhal::addr::PhysAddr"]],["impl UnwindSafe for VirtAddr",1,["polyhal::addr::VirtAddr"]],["impl UnwindSafe for PhysPage",1,["polyhal::addr::PhysPage"]],["impl UnwindSafe for VirtPage",1,["polyhal::addr::VirtPage"]],["impl UnwindSafe for DebugConsole",1,["polyhal::debug::DebugConsole"]],["impl UnwindSafe for Instruction",1,["polyhal::instruction::Instruction"]],["impl UnwindSafe for IRQ",1,["polyhal::irq::IRQ"]],["impl UnwindSafe for Barrier",1,["polyhal::mem::Barrier"]],["impl UnwindSafe for MultiCore",1,["polyhal::multicore::MultiCore"]],["impl<T> UnwindSafe for LazyInit<T>where\n T: UnwindSafe,",1,["polyhal::once::LazyInit"]],["impl UnwindSafe for MappingFlags",1,["polyhal::pagetable::MappingFlags"]],["impl UnwindSafe for MappingSize",1,["polyhal::pagetable::MappingSize"]],["impl UnwindSafe for PageTable",1,["polyhal::pagetable::PageTable"]],["impl UnwindSafe for TLB",1,["polyhal::pagetable::TLB"]],["impl UnwindSafe for PageTableWrapper",1,["polyhal::pagetable::PageTableWrapper"]],["impl UnwindSafe for Time",1,["polyhal::time::Time"]],["impl UnwindSafe for TrapFrame",1,["polyhal::currrent_arch::context::TrapFrame"]],["impl UnwindSafe for KContext",1,["polyhal::currrent_arch::kcontext::KContext"]],["impl UnwindSafe for KContextArgs",1,["polyhal::KContextArgs"]],["impl UnwindSafe for TrapFrameArgs",1,["polyhal::TrapFrameArgs"]],["impl UnwindSafe for TrapType",1,["polyhal::TrapType"]]] +};if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})() \ No newline at end of file