Skip to main content

Documented

Trait Documented 

Source
pub trait Documented {
    const DOCS: &'static str;
}
Expand description

Adds an associated constant DOCS on your type containing its documentation, allowing you to access its documentation at runtime.

The associated derive macro of this trait will error if the type does not have any doc comments. Use DocumentedOpt if this is undesirable.

For how to use the derive macro, see Documented.

Required Associated Constants§

Source

const DOCS: &'static str

The static doc comments on this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Documented for Avatar

Source§

const DOCS: &'static str = "An element that renders a user avatar with customizable appearance options.\n\n# Examples\n\n```\nuse ui::Avatar;\n\nAvatar::new(\"path/to/image.png\")\n.grayscale(true)\n.border_color(gpui::red());\n```"

Source§

impl Documented for Button

Source§

const DOCS: &'static str = "An element that creates a button with a label and optional icons.\n\nCommon buttons:\n- Label, Icon + Label: [`Button`] (this component)\n- Icon only: [`IconButton`]\n- Custom: [`ButtonLike`]\n\nTo create a more complex button than what the [`Button`] or [`IconButton`] components provide, use\n[`ButtonLike`] directly.\n\n# Examples\n\n**A button with a label**, is typically used in scenarios such as a form, where the button\'s label\nindicates what action will be performed when the button is clicked.\n\n```\nuse ui::prelude::*;\n\nButton::new(\"button_id\", \"Click me!\")\n.on_click(|event, window, cx| {\n// Handle click event\n});\n```\n\n**A toggleable button**, is typically used in scenarios such as a toolbar,\nwhere the button\'s state indicates whether a feature is enabled or not, or\na trigger for a popover menu, where clicking the button toggles the visibility of the menu.\n\n```\nuse ui::prelude::*;\n\nButton::new(\"button_id\", \"Click me!\")\n.start_icon(Icon::new(IconName::Check))\n.toggle_state(true)\n.on_click(|event, window, cx| {\n// Handle click event\n});\n```\n\nTo change the style of the button when it is selected use the [`selected_style`][Button::selected_style] method.\n\n```\nuse ui::prelude::*;\nuse ui::TintColor;\n\nButton::new(\"button_id\", \"Click me!\")\n.toggle_state(true)\n.selected_style(ButtonStyle::Tinted(TintColor::Accent))\n.on_click(|event, window, cx| {\n// Handle click event\n});\n```\nThis will create a button with a blue tinted background when selected.\n\n**A full-width button**, is typically used in scenarios such as the bottom of a modal or form, where it occupies the entire width of its container.\nThe button\'s content, including text and icons, is centered by default.\n\n```\nuse ui::prelude::*;\n\nlet button = Button::new(\"button_id\", \"Click me!\")\n.full_width()\n.on_click(|event, window, cx| {\n// Handle click event\n});\n```\n"

Source§

impl Documented for ButtonLike

Source§

const DOCS: &'static str = "A button-like element that can be used to create a custom button when\nprebuilt buttons are not sufficient. Use this sparingly, as it is\nunconstrained and may make the UI feel less consistent.\n\nThis is also used to build the prebuilt buttons."

Source§

impl Documented for CircularProgress

Source§

const DOCS: &'static str = "A circular progress indicator that displays progress as an arc growing clockwise from the top."

Source§

impl Documented for Color

Source§

const DOCS: &'static str = "Sets a color that has a consistent meaning across all themes."

Source§

impl Documented for Facepile

Source§

const DOCS: &'static str = "An element that displays a collection of (usually) faces stacked\nhorizontally, with the left-most face on top, visually descending\nfrom left to right.\n\nFacepiles are used to display a group of people or things,\nsuch as a list of participants in a collaboration session.\n\n# Examples\n\n## Default\n\nA default, horizontal facepile.\n\n```\nuse gpui::IntoElement;\nuse ui::{Avatar, Facepile, EXAMPLE_FACES};\n\nlet facepile = Facepile::new(\nEXAMPLE_FACES.iter().take(3).map(|&url|\nAvatar::new(url).into_any_element()).collect()\n);\n```"

Source§

impl Documented for ProgressBar

Source§

const DOCS: &'static str = "A progress bar is a horizontal bar that communicates the status of a process.\n\nA progress bar should not be used to represent indeterminate progress."