pub struct Form(/* private fields */);Expand description
Form fields, in order; setting a field again replaces it. A keyword
list [title: "Hi", published: true] in .glacier builds one.
Implementations§
Source§impl Form
impl Form
pub fn new() -> Self
Sourcepub fn with(self, name: &str, value: impl FormValue) -> Self
pub fn with(self, name: &str, value: impl FormValue) -> Self
Sets name to value. A nested form’s fields become
name[field], as Rails nests params:
[post: [title: "Hi"]] sends post[title]=Hi.
Sourcepub fn with_all<T: Display>(
self,
name: &str,
values: impl IntoIterator<Item = T>,
) -> Self
pub fn with_all<T: Display>( self, name: &str, values: impl IntoIterator<Item = T>, ) -> Self
Sends each value as name[], as Rails sends a list:
[ids: [1, 2]] in .glacier is ids[]=1&ids[]=2.
pub fn get(&self, name: &str) -> Option<&str>
Trait Implementations§
Source§impl<M: Model> From<Form> for Changeset<M>
Post.create(params_for(Post, title: "")) in a test.
impl<M: Model> From<Form> for Changeset<M>
Post.create(params_for(Post, title: "")) in a test.
impl StructuralPartialEq for Form
Auto Trait Implementations§
impl Freeze for Form
impl RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnsafeUnpin for Form
impl UnwindSafe for Form
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more