generated from mitchell/rust_template
update docs
This commit is contained in:
parent
e16b7fc9cb
commit
1dc93d69f4
@ -332,8 +332,8 @@ where
|
|||||||
<FDT as FromStr>::Err: ToString,
|
<FDT as FromStr>::Err: ToString,
|
||||||
{
|
{
|
||||||
/// Sets the parse functions to use the [`FromStr`] [`ToString`] and traits
|
/// Sets the parse functions to use the [`FromStr`] [`ToString`] and traits
|
||||||
/// for parsing and unparsing respectively. To trim the string before parsing,
|
/// for parsing and unparsing respectively. To trim the string before
|
||||||
/// see [`parse_trimed_string`].
|
/// parsing, see [`parse_trimmed`](Self::parse_trimmed)().
|
||||||
///
|
///
|
||||||
/// The parse and unparse functions define how to turn what the user
|
/// The parse and unparse functions define how to turn what the user
|
||||||
/// types in the form into what is stored in the form data struct and
|
/// types in the form into what is stored in the form data struct and
|
||||||
@ -349,7 +349,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the parse functions to use the [`FromStr`] [`ToString`] and traits
|
/// Sets the parse functions to use the [`FromStr`] [`ToString`] and traits
|
||||||
/// for parsing and unparsing respectively, similar to [`parse_string`].
|
/// for parsing and unparsing respectively, similar to
|
||||||
|
/// [`parse_string`](Self::parse_string)().
|
||||||
/// However, this method trims the string before parsing.
|
/// However, this method trims the string before parsing.
|
||||||
///
|
///
|
||||||
/// The parse and unparse functions define how to turn what the user
|
/// The parse and unparse functions define how to turn what the user
|
||||||
|
|||||||
17
src/form.rs
17
src/form.rs
@ -41,14 +41,14 @@ pub struct Form<FD: FormToolData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<FD: FormToolData> Form<FD> {
|
impl<FD: FormToolData> Form<FD> {
|
||||||
/// Gets the [`Validator`] for this form.
|
/// Gets the [`FormValidator`] for this form.
|
||||||
pub fn validator(&self) -> FormValidator<FD> {
|
pub fn validator(&self) -> FormValidator<FD> {
|
||||||
FormValidator {
|
FormValidator {
|
||||||
validations: self.validations.clone(),
|
validations: self.validations.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Validates the [`ToolFormData`], returning the result
|
/// Validates the [`FormToolData`], returning the result
|
||||||
pub fn validate(&self) -> Result<(), String> {
|
pub fn validate(&self) -> Result<(), String> {
|
||||||
let validator = self.validator();
|
let validator = self.validator();
|
||||||
validator.validate(&self.fd.get_untracked())
|
validator.validate(&self.fd.get_untracked())
|
||||||
@ -87,7 +87,7 @@ pub trait FormToolData: Clone + 'static {
|
|||||||
|
|
||||||
/// Defines how the form should be layed out and how the data should be parsed and validated.
|
/// Defines how the form should be layed out and how the data should be parsed and validated.
|
||||||
///
|
///
|
||||||
/// To construct a [`From`] object, use one of the [`get_form`()] methods.
|
/// To construct a [`From`] object, use one of the `get_form` methods.
|
||||||
///
|
///
|
||||||
/// Uses the given form builder to specify what fields should be present
|
/// Uses the given form builder to specify what fields should be present
|
||||||
/// in the form, what properties those fields should have, and how that
|
/// in the form, what properties those fields should have, and how that
|
||||||
@ -131,8 +131,7 @@ pub trait FormToolData: Clone + 'static {
|
|||||||
///
|
///
|
||||||
/// This renders the form as a the leptos_router
|
/// This renders the form as a the leptos_router
|
||||||
/// [`ActionForm`](leptos_router::ActionForm)
|
/// [`ActionForm`](leptos_router::ActionForm)
|
||||||
/// component. Call [`get_form`]\() to get the plain
|
/// component.
|
||||||
/// [`Form`](leptos_router::Form) version.
|
|
||||||
///
|
///
|
||||||
/// For the other ways to construct a [`Form`], see:
|
/// For the other ways to construct a [`Form`], see:
|
||||||
/// - [`get_form`](Self::get_form)
|
/// - [`get_form`](Self::get_form)
|
||||||
@ -157,8 +156,7 @@ pub trait FormToolData: Clone + 'static {
|
|||||||
///
|
///
|
||||||
/// This renders the form as a the leptos_router
|
/// This renders the form as a the leptos_router
|
||||||
/// [`Form`](leptos_router::Form)
|
/// [`Form`](leptos_router::Form)
|
||||||
/// component. Call [`get_action_form`]\() to get the
|
/// component.
|
||||||
/// [`ActionForm`](leptos_router::ActionForm) version.
|
|
||||||
///
|
///
|
||||||
/// For the other ways to construct a [`Form`], see:
|
/// For the other ways to construct a [`Form`], see:
|
||||||
/// - [`get_form`](Self::get_form)
|
/// - [`get_form`](Self::get_form)
|
||||||
@ -174,7 +172,7 @@ pub trait FormToolData: Clone + 'static {
|
|||||||
builder.build_plain_form(action.to_string(), self, style)
|
builder.build_plain_form(action.to_string(), self, style)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a [`Validator`] for this [`ToolFormData`].
|
/// Gets a [`FormValidator`] for this [`FormToolData`].
|
||||||
///
|
///
|
||||||
/// This doesn't render the view, but just collects all the validation
|
/// This doesn't render the view, but just collects all the validation
|
||||||
/// Functions from building the form. That means it can be called on the
|
/// Functions from building the form. That means it can be called on the
|
||||||
@ -190,7 +188,8 @@ pub trait FormToolData: Clone + 'static {
|
|||||||
|
|
||||||
/// Validates this [`FormToolData`] struct.
|
/// Validates this [`FormToolData`] struct.
|
||||||
///
|
///
|
||||||
/// This is shorthand for creating a validator with [`get_validator`]
|
/// This is shorthand for creating a validator with
|
||||||
|
/// [`get_validator`](Self::get_validator)()
|
||||||
/// and then calling `validator.validate(&self, context)`.
|
/// and then calling `validator.validate(&self, context)`.
|
||||||
fn validate(&self, context: Self::Context) -> Result<(), String> {
|
fn validate(&self, context: Self::Context) -> Result<(), String> {
|
||||||
let validator = Self::get_validator(context);
|
let validator = Self::get_validator(context);
|
||||||
|
|||||||
Reference in New Issue
Block a user