Struct CanvasRenderingContext2D

Source
pub struct CanvasRenderingContext2D(/* private fields */);

Implementations§

Source§

impl CanvasRenderingContext2D

Source

pub fn reset_transform(&self) -> JsNullish

Source

pub fn get_transform(&self) -> DOMMatrix

Source

pub fn save(&self) -> JsNullish

Source

pub fn restore(&self) -> JsNullish

Source

pub fn reset(&self) -> JsNullish

Source

pub fn get_line_dash_method(&self) -> Array<JsNumber>

Source

pub fn close_path(&self) -> JsNullish

Source

pub fn stroke(&self) -> JsNullish

Source

pub fn begin_path(&self) -> JsNullish

Source

pub fn get_context_attributes(&self) -> CanvasRenderingContext2DSettings

Source

pub fn new(browser: &Browser) -> CanvasRenderingContext2D

Source

pub fn draw_focus_if_needed(&self, element: &Element) -> JsNullish

Source

pub fn set_transform( &self, transform: &dyn ToJs<JsNullable<DOMMatrix2DInit>>, ) -> JsNullish

Source

pub fn rotate(&self, angle: &dyn ToJs<JsNumber>) -> JsNullish

Source

pub fn measure_text(&self, text: &dyn ToJs<JsString>) -> TextMetrics

Source

pub fn set_line_dash_method( &self, segments: &dyn ToJs<Array<JsNumber>>, ) -> JsNullish

Source

pub fn create_image_data(&self, imagedata: &ImageData) -> ImageData

Source

pub fn stroke_with_path(&self, path: &Path2D) -> JsNullish

Source

pub fn fill(&self, fillRule: &dyn ToJs<JsNullable<JsString>>) -> JsNullish

Source

pub fn clip(&self, fillRule: &dyn ToJs<JsNullable<JsString>>) -> JsNullish

Source

pub fn draw_focus_if_needed_with_path_element( &self, path: &Path2D, element: &Element, ) -> JsNullish

Source

pub fn scale(&self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>) -> JsNullish

Source

pub fn move_to( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn line_to( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn create_pattern( &self, image: &dyn ToJs<JsValue>, repetition: &dyn ToJs<JsNullable<JsString>>, ) -> JsNullable<CanvasPattern>

Source

pub fn translate( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn is_point_in_stroke( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> JsBoolean

Source

pub fn fill_with_path_fillRule( &self, path: &Path2D, fillRule: &dyn ToJs<JsNullable<JsString>>, ) -> JsNullish

Source

pub fn clip_with_path_fillRule( &self, path: &Path2D, fillRule: &dyn ToJs<JsNullable<JsString>>, ) -> JsNullish

Source

pub fn put_image_data( &self, imagedata: &ImageData, dx: &dyn ToJs<JsNumber>, dy: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn create_image_data_with_sw_sh_settings( &self, sw: &dyn ToJs<JsNumber>, sh: &dyn ToJs<JsNumber>, settings: &dyn ToJs<JsNullable<ImageDataSettings>>, ) -> ImageData

Source

pub fn create_conic_gradient( &self, startAngle: &dyn ToJs<JsNumber>, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> CanvasGradient

Source

pub fn is_point_in_stroke_with_path_x_y( &self, path: &Path2D, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> JsBoolean

Source

pub fn is_point_in_path( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, fillRule: &dyn ToJs<JsNullable<JsString>>, ) -> JsBoolean

Source

pub fn draw_image( &self, image: &dyn ToJs<JsValue>, dx: &dyn ToJs<JsNumber>, dy: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn fill_rect( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, w: &dyn ToJs<JsNumber>, h: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn rect( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, w: &dyn ToJs<JsNumber>, h: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn fill_text( &self, text: &dyn ToJs<JsString>, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, maxWidth: &dyn ToJs<JsNullable<JsNumber>>, ) -> JsNullish

Source

pub fn create_linear_gradient( &self, x0: &dyn ToJs<JsNumber>, y0: &dyn ToJs<JsNumber>, x1: &dyn ToJs<JsNumber>, y1: &dyn ToJs<JsNumber>, ) -> CanvasGradient

Source

pub fn is_point_in_path_with_path_x_y_fillRule( &self, path: &Path2D, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, fillRule: &dyn ToJs<JsNullable<JsString>>, ) -> JsBoolean

Source

pub fn quadratic_curve_to( &self, cpx: &dyn ToJs<JsNumber>, cpy: &dyn ToJs<JsNumber>, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn stroke_rect( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, w: &dyn ToJs<JsNumber>, h: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn clear_rect( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, w: &dyn ToJs<JsNumber>, h: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn stroke_text( &self, text: &dyn ToJs<JsString>, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, maxWidth: &dyn ToJs<JsNullable<JsNumber>>, ) -> JsNullish

Source

pub fn arc_to( &self, x1: &dyn ToJs<JsNumber>, y1: &dyn ToJs<JsNumber>, x2: &dyn ToJs<JsNumber>, y2: &dyn ToJs<JsNumber>, radius: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn get_image_data( &self, sx: &dyn ToJs<JsNumber>, sy: &dyn ToJs<JsNumber>, sw: &dyn ToJs<JsNumber>, sh: &dyn ToJs<JsNumber>, settings: &dyn ToJs<JsNullable<ImageDataSettings>>, ) -> ImageData

Source

pub fn round_rect( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, w: &dyn ToJs<JsNumber>, h: &dyn ToJs<JsNumber>, radii: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish

Source

pub fn draw_image_with_image_dx_dy_dw_dh( &self, image: &dyn ToJs<JsValue>, dx: &dyn ToJs<JsNumber>, dy: &dyn ToJs<JsNumber>, dw: &dyn ToJs<JsNumber>, dh: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn bezier_curve_to( &self, cp1x: &dyn ToJs<JsNumber>, cp1y: &dyn ToJs<JsNumber>, cp2x: &dyn ToJs<JsNumber>, cp2y: &dyn ToJs<JsNumber>, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn set_transform_with_a_b_c_d_e_f( &self, a: &dyn ToJs<JsNumber>, b: &dyn ToJs<JsNumber>, c: &dyn ToJs<JsNumber>, d: &dyn ToJs<JsNumber>, e: &dyn ToJs<JsNumber>, f: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn arc( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, radius: &dyn ToJs<JsNumber>, startAngle: &dyn ToJs<JsNumber>, endAngle: &dyn ToJs<JsNumber>, counterclockwise: &dyn ToJs<JsNullable<JsBoolean>>, ) -> JsNullish

Source

pub fn transform( &self, a: &dyn ToJs<JsNumber>, b: &dyn ToJs<JsNumber>, c: &dyn ToJs<JsNumber>, d: &dyn ToJs<JsNumber>, e: &dyn ToJs<JsNumber>, f: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn create_radial_gradient( &self, x0: &dyn ToJs<JsNumber>, y0: &dyn ToJs<JsNumber>, r0: &dyn ToJs<JsNumber>, x1: &dyn ToJs<JsNumber>, y1: &dyn ToJs<JsNumber>, r1: &dyn ToJs<JsNumber>, ) -> CanvasGradient

Source

pub fn put_image_data_with_imagedata_dx_dy_dirtyX_dirtyY_dirtyWidth_dirtyHeight( &self, imagedata: &ImageData, dx: &dyn ToJs<JsNumber>, dy: &dyn ToJs<JsNumber>, dirtyX: &dyn ToJs<JsNumber>, dirtyY: &dyn ToJs<JsNumber>, dirtyWidth: &dyn ToJs<JsNumber>, dirtyHeight: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn ellipse( &self, x: &dyn ToJs<JsNumber>, y: &dyn ToJs<JsNumber>, radiusX: &dyn ToJs<JsNumber>, radiusY: &dyn ToJs<JsNumber>, rotation: &dyn ToJs<JsNumber>, startAngle: &dyn ToJs<JsNumber>, endAngle: &dyn ToJs<JsNumber>, counterclockwise: &dyn ToJs<JsNullable<JsBoolean>>, ) -> JsNullish

Source

pub fn draw_image_with_image_sx_sy_sw_sh_dx_dy_dw_dh( &self, image: &dyn ToJs<JsValue>, sx: &dyn ToJs<JsNumber>, sy: &dyn ToJs<JsNumber>, sw: &dyn ToJs<JsNumber>, sh: &dyn ToJs<JsNumber>, dx: &dyn ToJs<JsNumber>, dy: &dyn ToJs<JsNumber>, dw: &dyn ToJs<JsNumber>, dh: &dyn ToJs<JsNumber>, ) -> JsNullish

Source

pub fn get_text_baseline(&self) -> JsString

Source

pub fn set_text_baseline(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_text_align(&self) -> JsString

Source

pub fn set_text_align(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_font_kerning(&self) -> JsString

Source

pub fn set_font_kerning(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_font(&self) -> JsString

Source

pub fn set_font(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_direction(&self) -> JsString

Source

pub fn set_direction(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_shadow_offset_y(&self) -> JsNumber

Source

pub fn set_shadow_offset_y(&self, value: &dyn ToJs<JsNumber>)

Source

pub fn get_shadow_offset_x(&self) -> JsNumber

Source

pub fn set_shadow_offset_x(&self, value: &dyn ToJs<JsNumber>)

Source

pub fn get_shadow_color(&self) -> JsString

Source

pub fn set_shadow_color(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_shadow_blur(&self) -> JsNumber

Source

pub fn set_shadow_blur(&self, value: &dyn ToJs<JsNumber>)

Source

pub fn get_miter_limit(&self) -> JsNumber

Source

pub fn set_miter_limit(&self, value: &dyn ToJs<JsNumber>)

Source

pub fn get_line_width(&self) -> JsNumber

Source

pub fn set_line_width(&self, value: &dyn ToJs<JsNumber>)

Source

pub fn get_line_join(&self) -> JsString

Source

pub fn set_line_join(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_line_dash_offset(&self) -> JsNumber

Source

pub fn set_line_dash_offset(&self, value: &dyn ToJs<JsNumber>)

Source

pub fn get_line_cap(&self) -> JsString

Source

pub fn set_line_cap(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_image_smoothing_quality(&self) -> JsString

Source

pub fn set_image_smoothing_quality(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_image_smoothing_enabled(&self) -> JsBoolean

Source

pub fn set_image_smoothing_enabled(&self, value: &dyn ToJs<JsBoolean>)

Source

pub fn get_filter(&self) -> JsString

Source

pub fn set_filter(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_stroke_style(&self) -> JsValue

Source

pub fn set_stroke_style(&self, value: &dyn ToJs<JsValue>)

Source

pub fn get_fill_style(&self) -> JsValue

Source

pub fn set_fill_style(&self, value: &dyn ToJs<JsValue>)

Source

pub fn get_global_composite_operation(&self) -> JsString

Source

pub fn set_global_composite_operation(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_global_alpha(&self) -> JsNumber

Source

pub fn set_global_alpha(&self, value: &dyn ToJs<JsNumber>)

Source

pub fn get_canvas(&self) -> HTMLCanvasElement

Source

pub fn set_canvas(&self, value: &HTMLCanvasElement)

Source

pub fn get_prototype(browser: &Browser) -> CanvasRenderingContext2D

Source

pub fn set_prototype(browser: &Browser, value: &CanvasRenderingContext2D)

Methods from Deref<Target = JsObject>§

Source

pub fn js_get_field(&self, property: &dyn UseInJsCode) -> JsValue

Get a field value of in this object.

WSDOM provides built-in getters so you should use that instead when possible.

Use js_get_field only when needed

fn example(browser: Browser) {
    // you can get `window["location"]["href"]` like this
    let href: JsValue = wsdom::dom::location(&browser).js_get_field(&"href");

    // but you should use built-in getters instead
    let href: JsString = wsdom::dom::location(&browser).get_href();
}
Source

pub fn js_set_field(&self, property: &dyn UseInJsCode, value: &dyn UseInJsCode)

Set a field value of in this object.

WSDOM provides built-in setters so you should use that instead when possible.

Use js_set_field only when needed

fn example(browser: Browser) {
    // you can set `window["location"]["href"]` like this
    wsdom::dom::location(&browser).js_set_field(&"href", &"https://example.com/");

    // but you should use built-in setters instead
    wsdom::dom::location(&browser).set_href(&"https://example.com");
}
Source

pub fn js_call_method<'a>( &'a self, method_name: &'a str, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue

Call a method on this object.

Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.

fn example(browser: &Browser) {
    let console = wsdom::dom::console(browser);
    // you can call console.log like this
    console.js_call_method("log", [&"hello" as &_], false);
     
    // but the better way is to use
    wsdom::dom::console(&browser).log(&[&"Hello" as &_]);
}

Be aware that the first argument (method_name) is NOT escaped.

Set last_arg_variadic to true if you want to “spread” the last argument as obj.method(arg1, arg2, ...arg3).

Source

pub fn js_call_self<'a>( &'a self, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue

Call this object: obj().

Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.

Methods from Deref<Target = JsValue>§

Source

pub fn browser(&self) -> &Browser

Source

pub fn retrieve_json(&self) -> RetrieveFuture<'_, Value>

Retrive this value from the JS side to the Rust side. Returns Future whose output is a serde_json::Value.

§use wsdom::dom::Browser
§use wsdom::dom::HTMLInputElement;

async fn example(input: &HTMLInputElement) { let _val = input.get_value().retrieve_json().await; }

Trait Implementations§

Source§

impl AsRef<CanvasCompositing> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasCompositing

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasDrawImage> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasDrawImage

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasDrawPath> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasDrawPath

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasFillStrokeStyles> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasFillStrokeStyles

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasFilters> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasFilters

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasImageData> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasImageData

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasImageSmoothing> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasImageSmoothing

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasPath> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasPath

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasPathDrawingStyles> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasPathDrawingStyles

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasRect> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasRect

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasRenderingContext2D> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasShadowStyles> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasShadowStyles

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasState> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasState

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasText> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasText

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasTextDrawingStyles> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasTextDrawingStyles

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasTransform> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasTransform

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CanvasUserInterface> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &CanvasUserInterface

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<JsObject> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &JsObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<JsValue> for CanvasRenderingContext2D

Source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for CanvasRenderingContext2D

Source§

fn clone(&self) -> CanvasRenderingContext2D

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for CanvasRenderingContext2D

Source§

type Target = JsObject

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Into<CanvasCompositing> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasCompositing

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasDrawImage> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasDrawImage

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasDrawPath> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasDrawPath

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasFillStrokeStyles> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasFillStrokeStyles

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasFilters> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasFilters

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasImageData> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasImageData

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasImageSmoothing> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasImageSmoothing

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasPath> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasPath

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasPathDrawingStyles> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasPathDrawingStyles

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasRect> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasRect

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasShadowStyles> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasShadowStyles

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasState> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasState

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasText> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasText

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasTextDrawingStyles> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasTextDrawingStyles

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasTransform> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasTransform

Converts this type into the (usually inferred) input type.
Source§

impl Into<CanvasUserInterface> for CanvasRenderingContext2D

Source§

fn into(self) -> CanvasUserInterface

Converts this type into the (usually inferred) input type.
Source§

impl Into<JsObject> for CanvasRenderingContext2D

Source§

fn into(self) -> JsObject

Converts this type into the (usually inferred) input type.
Source§

impl Into<JsValue> for CanvasRenderingContext2D

Source§

fn into(self) -> JsValue

Converts this type into the (usually inferred) input type.
Source§

impl JsCast for CanvasRenderingContext2D

Source§

fn unchecked_from_js(val: JsValue) -> Self

Source§

fn unchecked_from_js_ref(val: &JsValue) -> &Self

Source§

fn unchecked_into<T>(self) -> T
where T: JsCast,

Source§

fn unchecked_ref<T>(&self) -> &T
where T: JsCast,

Source§

impl RefCast for CanvasRenderingContext2D

Source§

type From = JsValue

Source§

fn ref_cast(_from: &Self::From) -> &Self

Source§

fn ref_cast_mut(_from: &mut Self::From) -> &mut Self

Source§

impl UseInJsCode for CanvasRenderingContext2D

Source§

fn serialize_to(&self, buf: &mut Formatter<'_>) -> Result

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> ToJs<T> for T
where T: UseInJsCode + ?Sized,