Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix doc warnings in xilem_core, xilem_web #478

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Don't warn about these identifiers when using clippy::doc_markdown.
doc-valid-idents = ["MathML", ".."]
4 changes: 2 additions & 2 deletions xilem_core/src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ where
}
}

/// A `View` with [no element](crate::NoElement) can be added to any ViewSequence, because it does not use any
/// properties of the Element type.
/// A `View` with [no element](crate::NoElement) can be added to any [`ViewSequence`], because it does not use any
/// properties of the `Element` type.
impl<State, Action, Context, Element, NoElementView, Message>
ViewSequence<State, Action, Context, Element, NoElement, Message> for NoElementView
where
Expand Down
4 changes: 2 additions & 2 deletions xilem_core/src/views/one_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,10 @@ mod hidden {
pub struct OneOfState<A, B, C, D, E, F, G, H, I> {
/// The current state of the inner view or view sequence.
pub(super) inner_state: super::OneOf<A, B, C, D, E, F, G, H, I>,
/// The generation this OneOfN is at.
/// The generation this `OneOfN` is at.
///
/// If the variant of `OneOfN` has changed, i.e. the type of the inner view,
/// the generation is incremented and used as ViewId in the id_path,
/// the generation is incremented and used as `ViewId` in the `id_path`,
/// to avoid (possibly async) messages reaching the wrong view,
/// See the implementations of other `ViewSequence`s for more details
pub(super) generation: u64,
Expand Down
2 changes: 1 addition & 1 deletion xilem_core/src/views/run_once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::{MessageResult, NoElement, View, ViewPathTracker};
/// You might otherwise expect the function to be reran when the captured values change, which is not the case.
/// [`run_once_raw`] is the same as `run_once`, but without this restriction.
///
/// // https://doc.rust-lang.org/error_codes/E0080.html
/// // <https://doc.rust-lang.org/error_codes/E0080.html>
/// // Note that this error code is only checked on nightly
/// ```compile_fail,E0080
/// # use xilem_core::{run_once, View, docs::{Fake as ViewCtx}, PhantomView};
Expand Down
4 changes: 2 additions & 2 deletions xilem_web/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
self
}

/// Whether the event handler should capture the event *before* being dispatched to any EventTarget beneath it in the DOM tree. (default = `false`)
/// Whether the event handler should capture the event *before* being dispatched to any `EventTarget` beneath it in the DOM tree. (default = `false`)
///
/// Events that are bubbling upward through the tree will not trigger a listener designated to use capture.
/// Event bubbling and capturing are two ways of propagating events that occur in an element that is nested within another element,
Expand Down Expand Up @@ -348,7 +348,7 @@ macro_rules! event_definitions {
self
}

/// Whether the event handler should capture the event *before* being dispatched to any EventTarget beneath it in the DOM tree. (default = `false`)
/// Whether the event handler should capture the event *before* being dispatched to any `EventTarget` beneath it in the DOM tree. (default = `false`)
///
/// Events that are bubbling upward through the tree will not trigger a listener designated to use capture.
/// Event bubbling and capturing are two ways of propagating events that occur in an element that is nested within another element,
Expand Down
4 changes: 2 additions & 2 deletions xilem_web/src/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ where
pub trait HtmlOptionElement<State, Action = ()>:
HtmlElement<State, Action, DomNode: AsRef<web_sys::HtmlOptionElement>>
{
/// A string representing the value of the HTMLOptionElement, i.e. the value attribute of the equivalent `<option>`.
/// A string representing the value of the `HTMLOptionElement`, i.e. the value attribute of the equivalent `<option>`.
/// If this is not specified, the value of text is used as the value, e.g. for the associated `<select>` element's value when the form is submitted to the server.
///
/// See <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#value> for more details
Expand Down Expand Up @@ -1037,7 +1037,7 @@ where
pub trait HtmlSelectElement<State, Action = ()>:
HtmlElement<State, Action, DomNode: AsRef<web_sys::HtmlSelectElement>>
{
/// A string representing the value of the HTMLOptionElement, i.e. the value attribute of the equivalent `<option>`.
/// A string representing the value of the `HTMLOptionElement`, i.e. the value attribute of the equivalent `<option>`.
/// If this is not specified, the value of text is used as the value, e.g. for the associated `<select>` element's value when the form is submitted to the server.
///
/// See <https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/value> for more details
Expand Down
2 changes: 1 addition & 1 deletion xilem_web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ where
/// A view which can have any [`DomView`] type, see [`AnyView`] for more details.
pub type AnyDomView<State, Action = ()> = dyn AnyView<State, Action, ViewCtx, AnyPod, DynMessage>;

/// The central [`View`] derived trait to represent DOM nodes in xilem_web, it's the base for all [`View`]s in xilem_web
/// The central [`View`] derived trait to represent DOM nodes in `xilem_web`, it's the base for all [`View`]s in `xilem_web`
pub trait DomView<State, Action = ()>:
View<State, Action, ViewCtx, DynMessage, Element = Pod<Self::DomNode, Self::Props>>
{
Expand Down
2 changes: 1 addition & 1 deletion xilem_web/src/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use xilem_core::{MessageResult, Mut, View, ViewId, ViewPathTracker};

use crate::{interfaces::Element, DynMessage, ElementAsRef, ViewCtx};

/// A view that allows stateful handling of PointerEvents with [`PointerMsg`]
/// A view that allows stateful handling of [`PointerEvent`]s with [`PointerMsg`]
pub struct Pointer<V, T, A, F> {
child: V,
callback: F,
Expand Down
2 changes: 1 addition & 1 deletion xilem_web/src/vecmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::{borrow::Borrow, fmt, ops::Index};

/// Basically an ordered Map (similar as BTreeMap) with a Vec as backend for very few elements
/// Basically an ordered `Map` (similar as `BTreeMap`) with a `Vec` as backend for very few elements
/// As it uses linear search instead of a tree traversal,
/// which seems to be faster for small `n` (currently roughly `n < ~20` for the use case of diffing html attributes)
pub struct VecMap<K, V>(Vec<(K, V)>);
Expand Down
4 changes: 2 additions & 2 deletions xilem_web/web_examples/todomvc/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl AppState {
}
}

/// Load the current state from local_storage, or use the default.
/// Load the current state from local storage, or use the default.
pub fn load() -> Self {
let Some(raw) = storage().get_item(KEY).unwrap_throw() else {
return Default::default();
Expand All @@ -96,7 +96,7 @@ impl AppState {
}
}

/// Save the current state to local_storage
/// Save the current state to local storage
pub fn save(&self) {
let raw = serde_json::to_string(self).unwrap_throw();
storage().set_item(KEY, &raw).unwrap_throw();
Expand Down