KonnektorenJs

Struct KonnektorenJs 

Source
pub struct KonnektorenJs { /* private fields */ }
Expand description

KonnektorenJs is the main struct that provides an interface between Rust and JavaScript for the Konnektoren application. It manages various handlers for different aspects of the application’s functionality.

Implementations§

Source§

impl KonnektorenJs

Source

pub fn new(window: &Window) -> Self

Creates a new instance of KonnektorenJs.

This function initializes all the handlers and ensures that the window.konnektoren object exists in the JavaScript environment.

§Arguments
  • window - A reference to the JavaScript Window object.
§Returns

A new instance of KonnektorenJs.

Source

pub fn set_challenge_data(&self, challenge_data: Custom)

Sets the challenge data in the JavaScript environment.

§Arguments
  • challenge_data - The Custom challenge data to be set.
Source

pub fn set_result_data(&self, result_data: CustomChallengeResult)

Sets the result data in the JavaScript environment.

§Arguments
  • result_data - The CustomChallengeResult to be set.
Source

pub fn expose_send_event<F>(&self, on_event: F)
where F: 'static + FnMut(JsValue),

Exposes a function to send events from JavaScript to Rust.

§Arguments
  • on_event - A closure that will be called when an event is sent from JavaScript.
§Type Parameters
  • F - A closure type that takes a JsValue and returns nothing.
Source

pub fn expose_execute_command<F>(&self, on_command: F)
where F: 'static + FnMut(JsValue),

Exposes a function to execute commands from JavaScript in Rust.

§Arguments
  • on_command - A closure that will be called when a command is executed from JavaScript.
§Type Parameters
  • F - A closure type that takes a JsValue and returns nothing.
Source

pub fn execute_js(&self, js_code: &str)

Executes JavaScript code.

§Arguments
  • js_code - A string slice containing the JavaScript code to be executed.
Source

pub fn set_i18n_data(&mut self, i18n_data: Value)

Sets the internationalization (i18n) data.

§Arguments
  • i18n_data - A serde_json::Value containing the i18n data.
Source

pub fn finish_challenge(&self, result: Option<CustomChallengeResult>)

Finishes the current challenge with an optional result.

§Arguments
  • result - An optional CustomChallengeResult representing the result of the challenge.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: FloatComponent, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<Swp, Dwp, T>,

Convert the source color to the destination color using the specified method
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
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, 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, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
§

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

§

fn vzip(self) -> V