pub struct PageJs { /* private fields */ }Expand description
JS-visible wrapper around ferridriver::Page.
Held as Arc<Page> so the same page can be shared with the MCP session
while the script runs; dropping the wrapper does not close the page.
Implementations§
Source§impl PageJs
impl PageJs
pub const js_goto: __impl_goto = __impl_goto
pub const js_reload: __impl_reload = __impl_reload
pub const js_go_back: __impl_go_back = __impl_go_back
pub const js_go_forward: __impl_go_forward = __impl_go_forward
pub const js_url: __impl_url = __impl_url
pub const js_title: __impl_title = __impl_title
pub const js_video: __impl_video = __impl_video
pub const js_content: __impl_content = __impl_content
pub const js_set_content: __impl_set_content = __impl_set_content
pub const js_add_init_script: __impl_add_init_script = __impl_add_init_script
pub const js_remove_init_script: __impl_remove_init_script = __impl_remove_init_script
pub const js_markdown: __impl_markdown = __impl_markdown
pub const js_wait_for_selector: __impl_wait_for_selector = __impl_wait_for_selector
pub const js_query_selector: __impl_query_selector = __impl_query_selector
pub const js_dollar: __impl_dollar = __impl_dollar
pub const js_query_selector_all: __impl_query_selector_all = __impl_query_selector_all
pub const js_dollar_dollar: __impl_dollar_dollar = __impl_dollar_dollar
pub const js_evaluate: __impl_evaluate = __impl_evaluate
pub const js_evaluate_handle: __impl_evaluate_handle = __impl_evaluate_handle
pub const js_locator: __impl_locator = __impl_locator
pub const js_get_by_role: __impl_get_by_role = __impl_get_by_role
pub const js_get_by_text: __impl_get_by_text = __impl_get_by_text
pub const js_get_by_label: __impl_get_by_label = __impl_get_by_label
pub const js_get_by_placeholder: __impl_get_by_placeholder = __impl_get_by_placeholder
pub const js_get_by_alt_text: __impl_get_by_alt_text = __impl_get_by_alt_text
pub const js_get_by_title: __impl_get_by_title = __impl_get_by_title
pub const js_get_by_test_id: __impl_get_by_test_id = __impl_get_by_test_id
pub const js_click: __impl_click = __impl_click
pub const js_dblclick: __impl_dblclick = __impl_dblclick
pub const js_fill: __impl_fill = __impl_fill
pub const js_type_: __impl_type_ = __impl_type_
pub const js_press: __impl_press = __impl_press
pub const js_focus: __impl_focus = __impl_focus
pub const js_hover: __impl_hover = __impl_hover
pub const js_dispatch_event: __impl_dispatch_event = __impl_dispatch_event
pub const js_tap: __impl_tap = __impl_tap
pub const js_check: __impl_check = __impl_check
pub const js_uncheck: __impl_uncheck = __impl_uncheck
pub const js_set_checked: __impl_set_checked = __impl_set_checked
pub const js_select_option: __impl_select_option = __impl_select_option
pub const js_text_content: __impl_text_content = __impl_text_content
pub const js_inner_text: __impl_inner_text = __impl_inner_text
pub const js_inner_html: __impl_inner_html = __impl_inner_html
pub const js_input_value: __impl_input_value = __impl_input_value
pub const js_get_attribute: __impl_get_attribute = __impl_get_attribute
pub const js_is_visible: __impl_is_visible = __impl_is_visible
pub const js_is_enabled: __impl_is_enabled = __impl_is_enabled
pub const js_is_disabled: __impl_is_disabled = __impl_is_disabled
pub const js_is_checked: __impl_is_checked = __impl_is_checked
pub const js_click_at: __impl_click_at = __impl_click_at
pub const js_move_mouse_smooth: __impl_move_mouse_smooth = __impl_move_mouse_smooth
pub const js_drag_and_drop: __impl_drag_and_drop = __impl_drag_and_drop
pub const js_set_input_files: __impl_set_input_files = __impl_set_input_files
pub const js_set_viewport_size: __impl_set_viewport_size = __impl_set_viewport_size
pub const js_emulate_media: __impl_emulate_media = __impl_emulate_media
pub const js_screenshot: __impl_screenshot = __impl_screenshot
pub const js_screenshot_element: __impl_screenshot_element = __impl_screenshot_element
pub const js_pdf: __impl_pdf = __impl_pdf
pub const js_close: __impl_close = __impl_close
pub const js_set_default_timeout: __impl_set_default_timeout = __impl_set_default_timeout
pub const js_is_closed: __impl_is_closed = __impl_is_closed
pub const js_route: __impl_route = __impl_route
pub const js_unroute: __impl_unroute = __impl_unroute
pub const js_wait_for_request: __impl_wait_for_request = __impl_wait_for_request
pub const js_wait_for_response: __impl_wait_for_response = __impl_wait_for_response
pub const js_wait_for_load_state: __impl_wait_for_load_state = __impl_wait_for_load_state
pub const js_wait_for_url: __impl_wait_for_url = __impl_wait_for_url
pub const js_wait_for_function: __impl_wait_for_function = __impl_wait_for_function
pub const js_wait_for_event: __impl_wait_for_event = __impl_wait_for_event
pub const js_main_frame: __impl_main_frame = __impl_main_frame
pub const js_frames: __impl_frames = __impl_frames
pub const js_frame_locator: __impl_frame_locator = __impl_frame_locator
pub const js_frame: __impl_frame = __impl_frame
pub const js_snapshot_for_ai: __impl_snapshot_for_ai = __impl_snapshot_for_ai
pub const js_aria_snapshot: __impl_aria_snapshot = __impl_aria_snapshot
pub const js_expose_function: __impl_expose_function = __impl_expose_function
pub const js_start_screencast: __impl_start_screencast = __impl_start_screencast
pub const js_stop_screencast: __impl_stop_screencast = __impl_stop_screencast
Source§impl PageJs
impl PageJs
pub fn new(inner: Arc<Page>) -> Self
pub fn new_with_async_ctx(inner: Arc<Page>, async_ctx: AsyncContext) -> Self
Sourcepub fn page_arc(&self) -> Arc<Page>
pub fn page_arc(&self) -> Arc<Page>
Clone of the wrapped Arc<Page> for cross-binding consumers
(used by expect() to lift a PageJs into an assertion target).
pub fn page(&self) -> &Arc<Page>
Source§impl PageJs
impl PageJs
Sourcepub async fn goto<'js>(
&self,
ctx: Ctx<'js>,
url: String,
options: Opt<Value<'js>>,
) -> Result<Option<ResponseJs>>
pub async fn goto<'js>( &self, ctx: Ctx<'js>, url: String, options: Opt<Value<'js>>, ) -> Result<Option<ResponseJs>>
Navigate to url. Accepts { waitUntil?, timeout?, referer? } to
mirror Playwright’s page.goto(url, options?).
Sourcepub async fn reload<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<Option<ResponseJs>>
pub async fn reload<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<Option<ResponseJs>>
Reload the current page. Accepts the same option bag as goto.
Sourcepub async fn go_back<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<Option<ResponseJs>>
pub async fn go_back<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<Option<ResponseJs>>
Navigate back in history. Accepts the same option bag as goto.
Sourcepub async fn go_forward<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<Option<ResponseJs>>
pub async fn go_forward<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<Option<ResponseJs>>
Navigate forward in history. Accepts the same option bag as goto.
Sourcepub fn url(&self) -> String
pub fn url(&self) -> String
Current URL of the page.
Playwright: page.url(): string — synchronous.
Sourcepub fn video<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn video<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Playwright: page.video(): null | Video —
/tmp/playwright/packages/playwright-core/types/types.d.ts:4756.
Returns a live Video handle when the owning context was
created with recordVideo, or null otherwise.
Sourcepub async fn set_content(&self, html: String) -> Result<()>
pub async fn set_content(&self, html: String) -> Result<()>
Replace the page’s HTML with html.
Sourcepub async fn add_init_script<'js>(
&self,
ctx: Ctx<'js>,
script: Value<'js>,
arg: Opt<Value<'js>>,
) -> Result<String>
pub async fn add_init_script<'js>( &self, ctx: Ctx<'js>, script: Value<'js>, arg: Opt<Value<'js>>, ) -> Result<String>
Register a JS snippet to run on every new document before any page
script executes. Mirrors Playwright’s
page.addInitScript(script, arg) — see
/tmp/playwright/packages/playwright-core/src/client/page.ts:520.
Accepts Function | string | { path?, content? } + optional arg
exactly like the NAPI binding; all lowering runs in Rust core via
ferridriver::options::evaluation_script.
Sourcepub async fn remove_init_script(&self, identifier: String) -> Result<()>
pub async fn remove_init_script(&self, identifier: String) -> Result<()>
Remove a previously-registered init script by identifier.
Sourcepub async fn markdown(&self) -> Result<String>
pub async fn markdown(&self) -> Result<String>
Full page rendered as clean Markdown (headings, lists, links, tables preserved; chrome and boilerplate stripped).
Sourcepub async fn wait_for_selector<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn wait_for_selector<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<()>
Wait for an element matching selector. Optional options object
accepts { state?: 'visible'|'hidden'|'attached'|'stable', timeout?: ms }.
Resolves when the condition is met; throws on timeout.
Sourcepub async fn query_selector(
&self,
selector: String,
) -> Result<Option<ElementHandleJs>>
pub async fn query_selector( &self, selector: String, ) -> Result<Option<ElementHandleJs>>
Playwright: page.querySelector(selector): Promise<ElementHandle | null>.
Mints a lifecycle crate::bindings::element_handle::ElementHandleJs
pinned to the first element matching selector, or null when no
element matches. Callers dispose() the handle when done to
release the backend remote.
Sourcepub async fn dollar(&self, selector: String) -> Result<Option<ElementHandleJs>>
pub async fn dollar(&self, selector: String) -> Result<Option<ElementHandleJs>>
Playwright $ shortcut for Self::query_selector.
Sourcepub async fn query_selector_all(
&self,
selector: String,
) -> Result<Vec<ElementHandleJs>>
pub async fn query_selector_all( &self, selector: String, ) -> Result<Vec<ElementHandleJs>>
Playwright: page.querySelectorAll(selector): Promise<ElementHandle[]>.
Sourcepub async fn dollar_dollar(
&self,
selector: String,
) -> Result<Vec<ElementHandleJs>>
pub async fn dollar_dollar( &self, selector: String, ) -> Result<Vec<ElementHandleJs>>
Playwright $$ shortcut for Self::query_selector_all.
Sourcepub async fn evaluate<'js>(
&self,
ctx: Ctx<'js>,
page_function: Value<'js>,
arg: Opt<Value<'js>>,
) -> Result<Value<'js>>
pub async fn evaluate<'js>( &self, ctx: Ctx<'js>, page_function: Value<'js>, arg: Opt<Value<'js>>, ) -> Result<Value<'js>>
Playwright: page.evaluate(pageFunction, arg?): Promise<R>.
pageFunction accepts a string or a JS function; rich return
types (Date / RegExp / BigInt / URL / Error / typed
arrays / NaN / ±Infinity / undefined / -0) arrive as
native JS, matching Playwright’s parseResult.
Sourcepub async fn evaluate_handle<'js>(
&self,
ctx: Ctx<'js>,
page_function: Value<'js>,
arg: Opt<Value<'js>>,
) -> Result<JSHandleJs>
pub async fn evaluate_handle<'js>( &self, ctx: Ctx<'js>, page_function: Value<'js>, arg: Opt<Value<'js>>, ) -> Result<JSHandleJs>
Playwright: page.evaluateHandle(pageFunction, arg?): Promise<JSHandle>.
Sourcepub fn locator<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<LocatorJs>
pub fn locator<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<LocatorJs>
Playwright: page.locator(selector, options?: LocatorOptions): Locator.
Thin delegator to Rust core’s Page::locator.
Sourcepub fn get_by_role(
&self,
role: String,
options: Opt<Value<'_>>,
) -> Result<LocatorJs>
pub fn get_by_role( &self, role: String, options: Opt<Value<'_>>, ) -> Result<LocatorJs>
Locate elements by ARIA role. Accepts { name: string | RegExp, exact, checked, disabled, expanded, level, pressed, selected, includeHidden } via the options bag.
Sourcepub fn get_by_text(
&self,
text: Value<'_>,
options: Opt<Value<'_>>,
) -> Result<LocatorJs>
pub fn get_by_text( &self, text: Value<'_>, options: Opt<Value<'_>>, ) -> Result<LocatorJs>
Locate elements containing the given text. Accepts string | RegExp.
Sourcepub fn get_by_label(
&self,
text: Value<'_>,
options: Opt<Value<'_>>,
) -> Result<LocatorJs>
pub fn get_by_label( &self, text: Value<'_>, options: Opt<Value<'_>>, ) -> Result<LocatorJs>
Locate form controls by associated label text.
Sourcepub fn get_by_placeholder(
&self,
text: Value<'_>,
options: Opt<Value<'_>>,
) -> Result<LocatorJs>
pub fn get_by_placeholder( &self, text: Value<'_>, options: Opt<Value<'_>>, ) -> Result<LocatorJs>
Locate inputs by placeholder text.
Sourcepub fn get_by_alt_text(
&self,
text: Value<'_>,
options: Opt<Value<'_>>,
) -> Result<LocatorJs>
pub fn get_by_alt_text( &self, text: Value<'_>, options: Opt<Value<'_>>, ) -> Result<LocatorJs>
Locate images/media by alt text.
Sourcepub fn get_by_title(
&self,
text: Value<'_>,
options: Opt<Value<'_>>,
) -> Result<LocatorJs>
pub fn get_by_title( &self, text: Value<'_>, options: Opt<Value<'_>>, ) -> Result<LocatorJs>
Locate elements by title attribute text.
Sourcepub fn get_by_test_id(&self, test_id: Value<'_>) -> Result<LocatorJs>
pub fn get_by_test_id(&self, test_id: Value<'_>) -> Result<LocatorJs>
Locate elements by data-testid. Accepts string | RegExp.
Sourcepub async fn click<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn click<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<()>
Click the first element matching selector. Accepts Playwright’s
full PageClickOptions bag.
Sourcepub async fn dblclick<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn dblclick<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<()>
Double-click the first element matching selector. Accepts
Playwright’s full PageDblClickOptions bag.
Sourcepub async fn fill<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
value: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn fill<'js>( &self, ctx: Ctx<'js>, selector: String, value: String, options: Opt<Value<'js>>, ) -> Result<()>
Fill value into the input matching selector. Accepts
Playwright’s full PageFillOptions bag.
Sourcepub async fn type_<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
text: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn type_<'js>( &self, ctx: Ctx<'js>, selector: String, text: String, options: Opt<Value<'js>>, ) -> Result<()>
Type text into the input matching selector. Accepts
Playwright’s full PageTypeOptions bag.
Exposed as type in JS (matches Playwright) — Rust renames to avoid
the type keyword.
Sourcepub async fn press<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
key: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn press<'js>( &self, ctx: Ctx<'js>, selector: String, key: String, options: Opt<Value<'js>>, ) -> Result<()>
Press key on the element matching selector. Accepts Playwright’s
full PagePressOptions bag.
Sourcepub async fn focus(
&self,
selector: String,
_options: Opt<Value<'_>>,
) -> Result<()>
pub async fn focus( &self, selector: String, _options: Opt<Value<'_>>, ) -> Result<()>
page.focus(selector, options?).
Sourcepub async fn hover<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn hover<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<()>
Hover the first element matching selector. Accepts Playwright’s
full PageHoverOptions bag.
Sourcepub async fn dispatch_event<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
event_type: String,
event_init: Opt<Value<'js>>,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn dispatch_event<'js>( &self, ctx: Ctx<'js>, selector: String, event_type: String, event_init: Opt<Value<'js>>, options: Opt<Value<'js>>, ) -> Result<()>
Dispatch a DOM event on the first element matching selector.
Mirrors Playwright’s page.dispatchEvent(selector, type, eventInit?, options?).
Sourcepub async fn tap<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn tap<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<()>
Tap (touch) the first element matching selector. Accepts
Playwright’s full PageTapOptions bag.
Sourcepub async fn check<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn check<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<()>
Check a checkbox matching selector. Accepts Playwright’s full
PageCheckOptions bag.
Sourcepub async fn uncheck<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn uncheck<'js>( &self, ctx: Ctx<'js>, selector: String, options: Opt<Value<'js>>, ) -> Result<()>
Uncheck a checkbox matching selector. Accepts Playwright’s full
PageUncheckOptions bag.
Sourcepub async fn set_checked<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
checked: bool,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn set_checked<'js>( &self, ctx: Ctx<'js>, selector: String, checked: bool, options: Opt<Value<'js>>, ) -> Result<()>
Set the checked state of a checkbox/radio matching selector.
Accepts Playwright’s full PageSetCheckedOptions bag.
Sourcepub async fn select_option<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
values: Value<'js>,
options: Opt<Value<'js>>,
) -> Result<Vec<String>>
pub async fn select_option<'js>( &self, ctx: Ctx<'js>, selector: String, values: Value<'js>, options: Opt<Value<'js>>, ) -> Result<Vec<String>>
Select options on the <select> matching selector. Returns the
values of the selected options. Accepts Playwright’s full
string | string[] | { value?, label?, index? } | Array<...> union.
Sourcepub async fn text_content(&self, selector: String) -> Result<Option<String>>
pub async fn text_content(&self, selector: String) -> Result<Option<String>>
Text content of the first element matching selector (or null).
Sourcepub async fn inner_text(&self, selector: String) -> Result<String>
pub async fn inner_text(&self, selector: String) -> Result<String>
innerText of the first element matching selector.
Sourcepub async fn inner_html(&self, selector: String) -> Result<String>
pub async fn inner_html(&self, selector: String) -> Result<String>
innerHTML of the first element matching selector.
Sourcepub async fn input_value(&self, selector: String) -> Result<String>
pub async fn input_value(&self, selector: String) -> Result<String>
Current input value of the first element matching selector.
Sourcepub async fn get_attribute(
&self,
selector: String,
name: String,
) -> Result<Option<String>>
pub async fn get_attribute( &self, selector: String, name: String, ) -> Result<Option<String>>
Get attribute name on the first element matching selector
(or null if the attribute is absent).
Sourcepub async fn is_visible(&self, selector: String) -> Result<bool>
pub async fn is_visible(&self, selector: String) -> Result<bool>
Whether the first element matching selector is visible.
Whether the first element matching selector is hidden.
Sourcepub async fn is_enabled(&self, selector: String) -> Result<bool>
pub async fn is_enabled(&self, selector: String) -> Result<bool>
Whether the first element matching selector is enabled.
Sourcepub async fn is_disabled(&self, selector: String) -> Result<bool>
pub async fn is_disabled(&self, selector: String) -> Result<bool>
Whether the first element matching selector is disabled.
Sourcepub async fn is_checked(&self, selector: String) -> Result<bool>
pub async fn is_checked(&self, selector: String) -> Result<bool>
Whether the first checkbox matching selector is checked.
Sourcepub async fn click_at(&self, x: f64, y: f64) -> Result<()>
pub async fn click_at(&self, x: f64, y: f64) -> Result<()>
ferridriver-specific (NOT Playwright): click at viewport
coordinates without a selector. Playwright equivalent: mouse.click(x, y).
Sourcepub async fn move_mouse_smooth(
&self,
from_x: f64,
from_y: f64,
to_x: f64,
to_y: f64,
steps: u32,
) -> Result<()>
pub async fn move_mouse_smooth( &self, from_x: f64, from_y: f64, to_x: f64, to_y: f64, steps: u32, ) -> Result<()>
ferridriver-specific (NOT Playwright): interpolated mouse move
from (fromX, fromY) to (toX, toY) in steps points. Playwright
equivalent: mouse.move(x, y, { steps }).
Sourcepub async fn drag_and_drop<'js>(
&self,
ctx: Ctx<'js>,
source: String,
target: String,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn drag_and_drop<'js>( &self, ctx: Ctx<'js>, source: String, target: String, options: Opt<Value<'js>>, ) -> Result<()>
Drag from the source selector to the target selector. Accepts
Playwright’s FrameDragAndDropOptions & TimeoutOptions bag:
{ force?, noWaitAfter?, sourcePosition?, targetPosition?, steps?, strict?, timeout?, trial? }.
Sourcepub async fn set_input_files<'js>(
&self,
ctx: Ctx<'js>,
selector: String,
files: Value<'js>,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn set_input_files<'js>( &self, ctx: Ctx<'js>, selector: String, files: Value<'js>, options: Opt<Value<'js>>, ) -> Result<()>
Attach files to a <input type="file"> selector. Accepts
Playwright’s full string | string[] | FilePayload | FilePayload[]
union plus the PageSetInputFilesOptions bag.
Sourcepub async fn set_viewport_size<'js>(
&self,
ctx: Ctx<'js>,
size: Value<'js>,
) -> Result<()>
pub async fn set_viewport_size<'js>( &self, ctx: Ctx<'js>, size: Value<'js>, ) -> Result<()>
Override the viewport size for this page. Playwright public:
page.setViewportSize({ width, height }).
Playwright: page.setViewportSize({ width, height }) — a single
object, not two positional numbers.
Sourcepub async fn emulate_media<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn emulate_media<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<()>
Emulate media features. Accepts Playwright’s
{ media?, colorScheme?, reducedMotion?, forcedColors?, contrast? }
option bag — each call is a partial update layered on top of the
page’s persistent emulated-media state.
Sourcepub async fn screenshot<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<Vec<u8>>
pub async fn screenshot<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<Vec<u8>>
Capture the page as a PNG (raw bytes — Uint8Array in JS). Pair with
await artifacts.writeBytes('page.png', bytes) to save to disk.
Optional options accept { fullPage?: boolean, format?: 'png'|'jpeg'|'webp', quality?: number }.
Sourcepub async fn screenshot_element(&self, selector: String) -> Result<Vec<u8>>
pub async fn screenshot_element(&self, selector: String) -> Result<Vec<u8>>
Capture a single element as PNG bytes.
Sourcepub async fn pdf<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<Vec<u8>>
pub async fn pdf<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<Vec<u8>>
Render the current page as a PDF (raw bytes). Accepts a Playwright-shape
options object: { format?, landscape?, printBackground?, scale?, ... }.
Pair with await artifacts.writeBytes('page.pdf', bytes) to save.
Sourcepub async fn close<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<()>
pub async fn close<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<()>
Close the page. Accepts { runBeforeUnload?, reason? } to mirror
Playwright’s page.close(options?).
Sourcepub fn set_default_timeout(&self, ms: u64)
pub fn set_default_timeout(&self, ms: u64)
Set the default timeout for all non-navigation operations
(milliseconds). Mirrors Playwright’s page.setDefaultTimeout(timeout).
Set the default timeout for navigation-family operations
(goto, reload, goBack, goForward, waitForUrl). Mirrors
Playwright’s page.setDefaultNavigationTimeout(timeout).
Sourcepub async fn route<'js>(
&self,
ctx: Ctx<'js>,
url: Value<'js>,
handler: Function<'js>,
) -> Result<()>
pub async fn route<'js>( &self, ctx: Ctx<'js>, url: Value<'js>, handler: Function<'js>, ) -> Result<()>
Mirrors Playwright page.route(url, handler). Registers a JS
callback to intercept requests matching url (string | RegExp).
The callback receives a Route instance and must call exactly one
of route.fulfill(), route.continue(), or route.abort() to
resume the request.
Cross-task dispatch: the Rust route handler runs inside the
backend’s network listener (a separate tokio task from the
script’s JS context). The handler stashes the JS callback in the
native RouteRegistry userdata keyed by ID at registration
time; when a request matches, the handler spawns a task that
async_withs back into the script’s AsyncContext, looks up the
callback by ID, and invokes it with a fresh RouteJs wrapper.
rquickjs’s scheduler serialises the dispatch against the
script’s own await points so JS-side state stays consistent.
Sourcepub async fn unroute<'js>(&self, ctx: Ctx<'js>, url: Value<'js>) -> Result<()>
pub async fn unroute<'js>(&self, ctx: Ctx<'js>, url: Value<'js>) -> Result<()>
page.unroute(string | RegExp | ((url: URL) => boolean)). A
predicate is matched by === identity against the function passed
to route, then its always-true core matcher is dropped by Arc
identity so sibling predicate routes survive.
Sourcepub async fn wait_for_request<'js>(
&self,
ctx: Ctx<'js>,
url: Value<'js>,
timeout_ms: Opt<f64>,
) -> Result<RequestJs>
pub async fn wait_for_request<'js>( &self, ctx: Ctx<'js>, url: Value<'js>, timeout_ms: Opt<f64>, ) -> Result<RequestJs>
page.waitForRequest(string | RegExp | ((r: Request) => boolean | Promise<boolean>), options?).
Sourcepub async fn wait_for_response<'js>(
&self,
ctx: Ctx<'js>,
url: Value<'js>,
timeout_ms: Opt<f64>,
) -> Result<ResponseJs>
pub async fn wait_for_response<'js>( &self, ctx: Ctx<'js>, url: Value<'js>, timeout_ms: Opt<f64>, ) -> Result<ResponseJs>
page.waitForResponse(string | RegExp | ((r: Response) => boolean | Promise<boolean>), options?).
Sourcepub async fn wait_for_load_state(&self, state: Opt<String>) -> Result<()>
pub async fn wait_for_load_state(&self, state: Opt<String>) -> Result<()>
Mirrors Playwright page.waitForEvent(event, options?). Dispatches
on the event name and returns the live class for the lifecycle
events (Request / Response / WebSocket), or a snapshot object
for simpler events. The overloaded return keeps the Playwright-
canonical call shape — scripts write await page.waitForEvent('websocket')
and receive a real WebSocket instance.
Playwright: page.waitForLoadState(state?: 'load' | 'domcontentloaded' | 'networkidle', options?). Defaults to
'load'. Thin delegator to Page::wait_for_load_state.
Sourcepub async fn wait_for_url<'js>(
&self,
ctx: Ctx<'js>,
url: Value<'js>,
) -> Result<()>
pub async fn wait_for_url<'js>( &self, ctx: Ctx<'js>, url: Value<'js>, ) -> Result<()>
Playwright: page.waitForURL(url: string | RegExp | (url:URL) => boolean, options?). Thin delegator to Page::wait_for_url
(a function predicate is reduced to an always-true matcher; the
function check is enforced by the core polling against the
current URL).
Sourcepub async fn wait_for_function<'js>(
&self,
ctx: Ctx<'js>,
page_function: Value<'js>,
_arg: Opt<Value<'js>>,
options: Opt<Value<'js>>,
) -> Result<Value<'js>>
pub async fn wait_for_function<'js>( &self, ctx: Ctx<'js>, page_function: Value<'js>, _arg: Opt<Value<'js>>, options: Opt<Value<'js>>, ) -> Result<Value<'js>>
Playwright: page.waitForFunction(pageFunction: Function|string, arg?, options?: { timeout?, polling? }). Function values get
String(fn) (Playwright parity) and are evaluated as IIFEs
inside the page. Returns the truthy value the function resolved
to.
pub async fn wait_for_event<'js>( &self, ctx: Ctx<'js>, event: String, timeout_ms: Opt<f64>, ) -> Result<Value<'js>>
Sourcepub fn main_frame(&self) -> FrameJs
pub fn main_frame(&self) -> FrameJs
Main frame of this page. Playwright: page.mainFrame(): Frame.
Always returns a Frame — the cache is seeded inside Page::new /
Page::with_context before the Page is handed out.
Sourcepub fn frames(&self) -> Vec<FrameJs>
pub fn frames(&self) -> Vec<FrameJs>
All non-detached frames on the page. Playwright:
page.frames(): Frame[].
Sourcepub fn frame_locator(&self, selector: String) -> FrameLocatorJs
pub fn frame_locator(&self, selector: String) -> FrameLocatorJs
Playwright: page.frameLocator(selector): FrameLocator. Targets
an <iframe> matching the selector at the page’s main-frame
scope.
Sourcepub fn frame<'js>(
&self,
ctx: Ctx<'js>,
selector: Value<'js>,
) -> Result<Option<FrameJs>>
pub fn frame<'js>( &self, ctx: Ctx<'js>, selector: Value<'js>, ) -> Result<Option<FrameJs>>
Locate a frame by name or URL. Accepts Playwright’s union:
frame(string | { name?: string; url?: string }).
Distinct null/undefined handling (like emulateMedia in task 3.24) is not required here — both absent and explicit-null mean “no filter on this field”, which matches Playwright’s optional-field semantics.
Sourcepub async fn snapshot_for_ai<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<Value<'js>>
pub async fn snapshot_for_ai<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<Value<'js>>
ferridriver-specific (NOT Playwright): structured AI snapshot
{ full: string, incremental?: string, refMap: Record<string, number> }.
Playwright’s public accessibility API is ariaSnapshot (string);
this richer shape feeds the MCP server’s incremental tracking.
Sourcepub async fn aria_snapshot<'js>(
&self,
ctx: Ctx<'js>,
options: Opt<Value<'js>>,
) -> Result<String>
pub async fn aria_snapshot<'js>( &self, ctx: Ctx<'js>, options: Opt<Value<'js>>, ) -> Result<String>
Playwright page.ariaSnapshot(options?): Promise<string>.
Sourcepub async fn expose_function<'js>(
&self,
ctx: Ctx<'js>,
name: String,
callback: Function<'js>,
) -> Result<()>
pub async fn expose_function<'js>( &self, ctx: Ctx<'js>, name: String, callback: Function<'js>, ) -> Result<()>
Playwright: page.exposeFunction(name, callback). Binds
window[name] to a page-side proxy that asynchronously invokes
callback(args) in the script context.
The callback receives the args as a single array. The page-side
call resolves to null since the script-side callback runs
asynchronously (Rust core’s ExposedFn is sync + JSON-in/out;
QuickJS dispatch is async-only).
Sourcepub async fn start_screencast<'js>(
&self,
ctx: Ctx<'js>,
quality: u8,
max_width: u32,
max_height: u32,
callback: Function<'js>,
) -> Result<()>
pub async fn start_screencast<'js>( &self, ctx: Ctx<'js>, quality: u8, max_width: u32, max_height: u32, callback: Function<'js>, ) -> Result<()>
ferridriver-specific (NOT Playwright): startScreencast(quality, maxWidth, maxHeight, callback). Callback receives { frame: Uint8Array, timestamp: number } per frame. Backed by CDP
Page.startScreencast; no Playwright client equivalent.
Sourcepub async fn stop_screencast(&self) -> Result<()>
pub async fn stop_screencast(&self) -> Result<()>
ferridriver-specific (NOT Playwright): stop the screencast
started by startScreencast.
Sourcepub fn mouse(&self) -> MouseJs
pub fn mouse(&self) -> MouseJs
page.mouse.* namespace: click, dblclick, down, up, wheel.
Exposed as a JS property, matching Playwright.
Sourcepub fn keyboard(&self) -> KeyboardJs
pub fn keyboard(&self) -> KeyboardJs
page.keyboard.* namespace: down, up, press (no selector; acts on
the currently focused element). Exposed as a JS property.
Sourcepub fn touchscreen(&self) -> TouchscreenJs
pub fn touchscreen(&self) -> TouchscreenJs
Playwright: page.touchscreen: Touchscreen.
Trait Implementations§
Source§impl<'js> JsClass<'js> for PageJs
impl<'js> JsClass<'js> for PageJs
Source§fn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>
fn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>
Source§impl<'js> JsLifetime<'js> for PageJs
impl<'js> JsLifetime<'js> for PageJs
Auto Trait Implementations§
impl Freeze for PageJs
impl !RefUnwindSafe for PageJs
impl Send for PageJs
impl Sync for PageJs
impl Unpin for PageJs
impl UnsafeUnpin for PageJs
impl !UnwindSafe for PageJs
Blanket Implementations§
Source§impl<'js, T> AsProperty<'js, T> for Twhere
T: IntoJs<'js>,
impl<'js, T> AsProperty<'js, T> for Twhere
T: IntoJs<'js>,
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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>
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 moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.