Struct matrix_sdk::widget::WidgetSettings
source · pub struct WidgetSettings { /* private fields */ }
experimental-widgets
only.Expand description
Settings of the widget.
Implementations§
source§impl WidgetSettings
impl WidgetSettings
sourcepub fn new_virtual_element_call_widget(
props: VirtualElementCallWidgetOptions,
) -> Result<Self, ParseError>
pub fn new_virtual_element_call_widget( props: VirtualElementCallWidgetOptions, ) -> Result<Self, ParseError>
WidgetSettings
are usually created from a state event.
(currently unimplemented)
In some cases the client wants to create custom WidgetSettings
for specific rooms based on other conditions.
This function returns a WidgetSettings
object which can be used
to setup a widget using run_client_widget_api
and to generate the correct url for the widget.
§Arguments
props
- A struct containing the configuration parameters for a element call widget.
source§impl WidgetSettings
impl WidgetSettings
sourcepub fn new(
id: String,
init_on_content_load: bool,
raw_url: &str,
) -> Result<Self, ParseError>
pub fn new( id: String, init_on_content_load: bool, raw_url: &str, ) -> Result<Self, ParseError>
Create a new WidgetSettings instance
sourcepub fn init_on_content_load(&self) -> bool
pub fn init_on_content_load(&self) -> bool
Whether or not the widget should be initialized on load message
(ContentLoad
message), or upon creation/attaching of the widget to
the SDK’s state machine that drives the API.
sourcepub fn raw_url(&self) -> &Url
pub fn raw_url(&self) -> &Url
This contains the url from the widget state event.
In this url placeholders can be used to pass information from the client
to the widget. Possible values are: $matrix_widget_id
,
$matrix_display_name
, etc.
§Examples
http://widget.domain?username=$userId
will become
http://widget.domain?username=@user_matrix_id:server.domain
.
sourcepub fn base_url(&self) -> Option<Url>
pub fn base_url(&self) -> Option<Url>
Get the base url of the widget. Used as the target for PostMessages. In
case the widget is in a webview and not an IFrame. It contains the
schema and the authority e.g. https://my.domain.org
. A postmessage would
be sent using: postMessage(myMessage, widget_base_url)
.
sourcepub async fn generate_webview_url(
&self,
room: &Room,
props: ClientProperties,
) -> Result<Url, ParseError>
pub async fn generate_webview_url( &self, room: &Room, props: ClientProperties, ) -> Result<Url, ParseError>
Trait Implementations§
source§impl Clone for WidgetSettings
impl Clone for WidgetSettings
source§fn clone(&self) -> WidgetSettings
fn clone(&self) -> WidgetSettings
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for WidgetSettings
impl RefUnwindSafe for WidgetSettings
impl Send for WidgetSettings
impl Sync for WidgetSettings
impl Unpin for WidgetSettings
impl UnwindSafe for WidgetSettings
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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