Skip to main content

SliderBlock

Struct SliderBlock 

Source
pub struct SliderBlock;
Expand description

slider: slides that scroll sideways, one at a time or several in a row.

Trait Implementations§

Source§

impl Block for SliderBlock

Source§

fn type_name(&self) -> &'static str

Wire-format identifier — the type key in the JSON envelope (e.g. "heading"). Must be globally unique across the process; duplicate registrations panic at boot.
Source§

fn verbose_name(&self) -> &'static str

Human-readable label shown in the admin picker + per-block header chip.
Source§

fn icon(&self) -> Option<&'static str>

Material-symbols icon name shown next to the block’s label in the picker + the per-block header. None → generic “widgets” glyph.
Source§

fn description(&self) -> Option<&'static str>

One-line description shown in the picker tile tooltip + the “what does this block do” hint when the editor hovers over an entry. None ⇒ no tooltip.
Source§

fn label_format(&self) -> Option<&'static str>

Collapsed-state header template. When non-None, the admin editor replaces the default static Self::verbose_name label with this string, substituting {field_name} tokens against the current block value. Useful so a Heading block in its collapsed state shows the actual heading text instead of just “Heading”. Read more
Source§

fn fields(&self) -> Vec<BlockField>

Structural shape. Each entry is rendered as one form input (or sub-stream) in the admin editor and one entry in the block’s stored value dict.
Source§

fn group(&self) -> Option<&'static str>

Picker grouping. Same string ⇒ same visual section in the “+ Add block” popover. None ⇒ “Other” bucket.
Source§

fn collapsed(&self) -> bool

Whether new instances of this block start collapsed in the admin editor. Default false (expanded). Set true for blocks whose default value already reads well in the collapsed header so the editor scrolls less when the page has many of them.
Source§

fn default_value(&self) -> Option<Value>

Initial value when a fresh instance of this block is inserted into a stream. None ⇒ the editor opens a blank instance (every field empty). Useful for blocks whose canonical entry state isn’t the all-empty shape (e.g. a Heading with level=h2 pre-selected). Read more
Source§

fn version(&self) -> u32

Schema version. Bump when this block’s fields() changes in a way that requires migrating stored JSON. Versions on disk that differ from this trigger Self::migrate on every load.
Source§

fn template(&self) -> Option<&'static str>

Optional override of the default render template (blocks/<type_name>.html). Useful for blocks that share a template with another (e.g. multiple heading-level variants).
Source§

fn preview_value(&self) -> Option<Value>

Sample value used to render a preview thumbnail inside the block-picker tile. When set, the admin pre-renders this block with the sample value (via Self::preview_template or the regular block template) and stashes the resulting HTML on each PickerOption. Editors get a “what does this look like” glimpse before they insert the block.
Source§

fn preview_template(&self) -> Option<&'static str>

Optional override of the template used for Self::preview_value rendering. Defaults to Self::template (the same template used for the public-side render). Useful when the block’s real template emits markup that needs heavy CSS / context to look right but a tiny mock preview is enough.
Source§

fn extra_context( &self, _value: &Value, _ctx: &BlockRenderCtx<'_>, ) -> Map<String, Value>

Augments the Tera ctx with derived values (e.g. a layout-string → grid-span map) before the block’s template renders. Default returns an empty map. Keys cannot shadow the framework’s own ctx entries (value, block_type, computed) — those are stamped last. Read more
Source§

fn render( &self, value: &Value, ctx: &BlockRenderCtx<'_>, ) -> Result<String, BlockError>

Render this block’s value to HTML. The default walks Self::fields, renders each into a Tera context map, and renders the registered template. Override only for blocks that bypass the field walker entirely. Read more
Source§

fn migrate(&self, _from: u32, value: Value) -> Result<Value, BlockError>

Migrate stored JSON from an older version() to the current one. The registry calls this stepwise — once per integer version between the stored value’s version and self.version() — so authors write single-version-step migrators only. Read more
Source§

impl Default for SliderBlock

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more