Struct qt_gui::QTextLayout

source ·
#[repr(C)]
pub struct QTextLayout { /* private fields */ }
Expand description

The QTextLayout class is used to lay out and render text.

C++ class: QTextLayout.

C++ documentation:

The QTextLayout class is used to lay out and render text.

It offers many features expected from a modern text layout engine, including Unicode compliant rendering, line breaking and handling of cursor positioning. It can also produce and render device independent layout, something that is important for WYSIWYG applications.

The class has a rather low level API and unless you intend to implement your own text rendering for some specialized widget, you probably won't need to use it directly.

QTextLayout can be used with both plain and rich text.

QTextLayout can be used to create a sequence of QTextLine instances with given widths and can position them independently on the screen. Once the layout is done, these lines can be drawn on a paint device.

The text to be laid out can be provided in the constructor or set with setText().

The layout can be seen as a sequence of QTextLine objects; use createLine() to create a QTextLine instance, and lineAt() or lineForTextPosition() to retrieve created lines.

Here is a code snippet that demonstrates the layout phase:

int leading = fontMetrics.leading(); qreal height = 0; textLayout.setCacheEnabled(true); textLayout.beginLayout(); while (1) { QTextLine line = textLayout.createLine(); if (!line.isValid()) break;

line.setLineWidth(lineWidth); height += leading; line.setPosition(QPointF(0, height)); height += line.height(); } textLayout.endLayout();

The text can then be rendered by calling the layout's draw() function:

QPainter painter(this); textLayout.draw(&painter, QPoint(0, 0));

For a given position in the text you can find a valid cursor position with isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition().

The QTextLayout itself can be positioned with setPosition(); it has a boundingRect(), and a minimumWidth() and a maximumWidth().

Implementations§

source§

impl QTextLayout

source

pub unsafe fn additional_formats(&self) -> CppBox<QListOfFormatRange>

See also setAdditionalFormats() and clearAdditionalFormats().

Calls C++ function: QList<QTextLayout::FormatRange> QTextLayout::additionalFormats() const.

C++ documentation:

source

pub unsafe fn begin_layout(&self)

Begins the layout process.

Calls C++ function: void QTextLayout::beginLayout().

C++ documentation:

Begins the layout process.

Warning: This will invalidate the layout, so all existing QTextLine objects that refer to the previous contents should now be discarded.

See also endLayout().

source

pub unsafe fn bounding_rect(&self) -> CppBox<QRectF>

The smallest rectangle that contains all the lines in the layout.

Calls C++ function: QRectF QTextLayout::boundingRect() const.

C++ documentation:

The smallest rectangle that contains all the lines in the layout.

source

pub unsafe fn cache_enabled(&self) -> bool

Returns true if the complete layout information is cached; otherwise returns false.

Calls C++ function: bool QTextLayout::cacheEnabled() const.

C++ documentation:

Returns true if the complete layout information is cached; otherwise returns false.

See also setCacheEnabled().

source

pub unsafe fn clear_additional_formats(&self)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Calls C++ function: void QTextLayout::clearAdditionalFormats().

C++ documentation:

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

source

pub unsafe fn clear_formats(&self)

Clears the list of additional formats supported by the text layout.

Calls C++ function: void QTextLayout::clearFormats().

C++ documentation:

Clears the list of additional formats supported by the text layout.

This function was introduced in Qt 5.6.

See also formats() and setFormats().

source

pub unsafe fn clear_layout(&self)

Clears the line information in the layout. After having called this function, lineCount() returns 0.

Calls C++ function: void QTextLayout::clearLayout().

C++ documentation:

Clears the line information in the layout. After having called this function, lineCount() returns 0.

Warning: This will invalidate the layout, so all existing QTextLine objects that refer to the previous contents should now be discarded.

This function was introduced in Qt 4.4.

source

pub unsafe fn create_line(&self) -> CppBox<QTextLine>

Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise returns an invalid text line.

Calls C++ function: QTextLine QTextLayout::createLine().

C++ documentation:

Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise returns an invalid text line.

The text layout creates a new line object that starts after the last line in the layout, or at the beginning if the layout is empty. The layout maintains an internal cursor, and each line is filled with text from the cursor position onwards when the QTextLine::setLineWidth() function is called.

Once QTextLine::setLineWidth() is called, a new line can be created and filled with text. Repeating this process will lay out the whole block of text contained in the QTextLayout. If there is no text left to be inserted into the layout, the QTextLine returned will not be valid (isValid() will return false).

source

pub unsafe fn cursor_move_style(&self) -> CursorMoveStyle

The cursor movement style of this QTextLayout. The default is Qt::LogicalMoveStyle.

Calls C++ function: Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const.

C++ documentation:

The cursor movement style of this QTextLayout. The default is Qt::LogicalMoveStyle.

See also setCursorMoveStyle().

source

pub unsafe fn draw_4a( &self, p: impl CastInto<Ptr<QPainter>>, pos: impl CastInto<Ref<QPointF>>, selections: impl CastInto<Ref<QVectorOfFormatRange>>, clip: impl CastInto<Ref<QRectF>> )

Draws the whole layout on the painter p at the position specified by pos. The rendered layout includes the given selections and is clipped within the rectangle specified by clip.

Calls C++ function: void QTextLayout::draw(QPainter* p, const QPointF& pos, const QVector<QTextLayout::FormatRange>& selections = …, const QRectF& clip = …) const.

C++ documentation:

Draws the whole layout on the painter p at the position specified by pos. The rendered layout includes the given selections and is clipped within the rectangle specified by clip.

source

pub unsafe fn draw_3a( &self, p: impl CastInto<Ptr<QPainter>>, pos: impl CastInto<Ref<QPointF>>, selections: impl CastInto<Ref<QVectorOfFormatRange>> )

Draws the whole layout on the painter p at the position specified by pos. The rendered layout includes the given selections and is clipped within the rectangle specified by clip.

Calls C++ function: void QTextLayout::draw(QPainter* p, const QPointF& pos, const QVector<QTextLayout::FormatRange>& selections = …) const.

C++ documentation:

Draws the whole layout on the painter p at the position specified by pos. The rendered layout includes the given selections and is clipped within the rectangle specified by clip.

source

pub unsafe fn draw_2a( &self, p: impl CastInto<Ptr<QPainter>>, pos: impl CastInto<Ref<QPointF>> )

Draws the whole layout on the painter p at the position specified by pos. The rendered layout includes the given selections and is clipped within the rectangle specified by clip.

Calls C++ function: void QTextLayout::draw(QPainter* p, const QPointF& pos) const.

C++ documentation:

Draws the whole layout on the painter p at the position specified by pos. The rendered layout includes the given selections and is clipped within the rectangle specified by clip.

source

pub unsafe fn draw_cursor_3a( &self, p: impl CastInto<Ptr<QPainter>>, pos: impl CastInto<Ref<QPointF>>, cursor_position: c_int )

This is an overloaded function.

Calls C++ function: void QTextLayout::drawCursor(QPainter* p, const QPointF& pos, int cursorPosition) const.

C++ documentation:

This is an overloaded function.

Draws a text cursor with the current pen at the given position using the painter specified. The corresponding position within the text is specified by cursorPosition.

source

pub unsafe fn draw_cursor_4a( &self, p: impl CastInto<Ptr<QPainter>>, pos: impl CastInto<Ref<QPointF>>, cursor_position: c_int, width: c_int )

Draws a text cursor with the current pen and the specified width at the given position using the painter specified. The corresponding position within the text is specified by cursorPosition.

Calls C++ function: void QTextLayout::drawCursor(QPainter* p, const QPointF& pos, int cursorPosition, int width) const.

C++ documentation:

Draws a text cursor with the current pen and the specified width at the given position using the painter specified. The corresponding position within the text is specified by cursorPosition.

source

pub unsafe fn end_layout(&self)

Ends the layout process.

Calls C++ function: void QTextLayout::endLayout().

C++ documentation:

Ends the layout process.

See also beginLayout().

source

pub unsafe fn font(&self) -> CppBox<QFont>

Returns the current font that is used for the layout, or a default font if none is set.

Calls C++ function: QFont QTextLayout::font() const.

C++ documentation:

Returns the current font that is used for the layout, or a default font if none is set.

See also setFont().

source

pub unsafe fn formats(&self) -> CppBox<QVectorOfFormatRange>

Returns the list of additional formats supported by the text layout.

Calls C++ function: QVector<QTextLayout::FormatRange> QTextLayout::formats() const.

C++ documentation:

Returns the list of additional formats supported by the text layout.

This function was introduced in Qt 5.6.

See also setFormats() and clearFormats().

source

pub unsafe fn glyph_runs_2a( &self, from: c_int, length: c_int ) -> CppBox<QListOfQGlyphRun>

Returns the glyph indexes and positions for all glyphs corresponding to the length characters starting at the position from in this QTextLayout. This is an expensive function, and should not be called in a time sensitive context.

Calls C++ function: QList<QGlyphRun> QTextLayout::glyphRuns(int from = …, int length = …) const.

C++ documentation:

Returns the glyph indexes and positions for all glyphs corresponding to the length characters starting at the position from in this QTextLayout. This is an expensive function, and should not be called in a time sensitive context.

If from is less than zero, then the glyph run will begin at the first character in the layout. If length is less than zero, it will span the entire string from the start position.

This function was introduced in Qt 4.8.

See also draw() and QPainter::drawGlyphRun().

source

pub unsafe fn glyph_runs_1a(&self, from: c_int) -> CppBox<QListOfQGlyphRun>

Returns the glyph indexes and positions for all glyphs corresponding to the length characters starting at the position from in this QTextLayout. This is an expensive function, and should not be called in a time sensitive context.

Calls C++ function: QList<QGlyphRun> QTextLayout::glyphRuns(int from = …) const.

C++ documentation:

Returns the glyph indexes and positions for all glyphs corresponding to the length characters starting at the position from in this QTextLayout. This is an expensive function, and should not be called in a time sensitive context.

If from is less than zero, then the glyph run will begin at the first character in the layout. If length is less than zero, it will span the entire string from the start position.

This function was introduced in Qt 4.8.

See also draw() and QPainter::drawGlyphRun().

source

pub unsafe fn glyph_runs_0a(&self) -> CppBox<QListOfQGlyphRun>

Returns the glyph indexes and positions for all glyphs corresponding to the length characters starting at the position from in this QTextLayout. This is an expensive function, and should not be called in a time sensitive context.

Calls C++ function: QList<QGlyphRun> QTextLayout::glyphRuns() const.

C++ documentation:

Returns the glyph indexes and positions for all glyphs corresponding to the length characters starting at the position from in this QTextLayout. This is an expensive function, and should not be called in a time sensitive context.

If from is less than zero, then the glyph run will begin at the first character in the layout. If length is less than zero, it will span the entire string from the start position.

This function was introduced in Qt 4.8.

See also draw() and QPainter::drawGlyphRun().

source

pub unsafe fn is_valid_cursor_position(&self, pos: c_int) -> bool

/ Returns true if position pos is a valid cursor position.

Calls C++ function: bool QTextLayout::isValidCursorPosition(int pos) const.

C++ documentation:

/ Returns true if position pos is a valid cursor position.

In a Unicode context some positions in the text are not valid cursor positions, because the position is inside a Unicode surrogate or a grapheme cluster.

A grapheme cluster is a sequence of two or more Unicode characters that form one indivisible entity on the screen. For example the latin character `Ä' can be represented in Unicode by two characters, `A' (0x41), and the combining diaresis (0x308). A text cursor can only validly be positioned before or after these two characters, never between them since that wouldn't make sense. In indic languages every syllable forms a grapheme cluster.

source

pub unsafe fn left_cursor_position(&self, old_pos: c_int) -> c_int

Returns the cursor position to the left of oldPos, next to it. It's dependent on the visual position of characters, after bi-directional reordering.

Calls C++ function: int QTextLayout::leftCursorPosition(int oldPos) const.

C++ documentation:

Returns the cursor position to the left of oldPos, next to it. It’s dependent on the visual position of characters, after bi-directional reordering.

See also rightCursorPosition() and previousCursorPosition().

source

pub unsafe fn line_at(&self, i: c_int) -> CppBox<QTextLine>

Returns the i-th line of text in this text layout.

Calls C++ function: QTextLine QTextLayout::lineAt(int i) const.

C++ documentation:

Returns the i-th line of text in this text layout.

See also lineCount() and lineForTextPosition().

source

pub unsafe fn line_count(&self) -> c_int

Returns the number of lines in this text layout.

Calls C++ function: int QTextLayout::lineCount() const.

C++ documentation:

Returns the number of lines in this text layout.

See also lineAt().

source

pub unsafe fn line_for_text_position(&self, pos: c_int) -> CppBox<QTextLine>

Returns the line that contains the cursor position specified by pos.

Calls C++ function: QTextLine QTextLayout::lineForTextPosition(int pos) const.

C++ documentation:

Returns the line that contains the cursor position specified by pos.

See also isValidCursorPosition() and lineAt().

source

pub unsafe fn maximum_width(&self) -> c_double

The maximum width the layout could expand to; this is essentially the width of the entire text.

Calls C++ function: double QTextLayout::maximumWidth() const.

C++ documentation:

The maximum width the layout could expand to; this is essentially the width of the entire text.

Warning: This function only returns a valid value after the layout has been done.

See also minimumWidth().

source

pub unsafe fn minimum_width(&self) -> c_double

The minimum width the layout needs. This is the width of the layout's smallest non-breakable substring.

Calls C++ function: double QTextLayout::minimumWidth() const.

C++ documentation:

The minimum width the layout needs. This is the width of the layout’s smallest non-breakable substring.

Warning: This function only returns a valid value after the layout has been done.

See also maximumWidth().

source

pub unsafe fn new() -> CppBox<QTextLayout>

Constructs an empty text layout.

Calls C++ function: [constructor] void QTextLayout::QTextLayout().

C++ documentation:

Constructs an empty text layout.

See also setText().

source

pub unsafe fn from_q_string( text: impl CastInto<Ref<QString>> ) -> CppBox<QTextLayout>

Constructs a text layout to lay out the given text.

Calls C++ function: [constructor] void QTextLayout::QTextLayout(const QString& text).

C++ documentation:

Constructs a text layout to lay out the given text.

source

pub unsafe fn from_q_string_q_font_q_paint_device( text: impl CastInto<Ref<QString>>, font: impl CastInto<Ref<QFont>>, paintdevice: impl CastInto<Ptr<QPaintDevice>> ) -> CppBox<QTextLayout>

Constructs a text layout to lay out the given text with the specified font.

Calls C++ function: [constructor] void QTextLayout::QTextLayout(const QString& text, const QFont& font, QPaintDevice* paintdevice = …).

C++ documentation:

Constructs a text layout to lay out the given text with the specified font.

All the metric and layout calculations will be done in terms of the paint device, paintdevice. If paintdevice is 0 the calculations will be done in screen metrics.

source

pub unsafe fn from_q_text_block( b: impl CastInto<Ref<QTextBlock>> ) -> CppBox<QTextLayout>

Calls C++ function: [constructor] void QTextLayout::QTextLayout(const QTextBlock& b).

source

pub unsafe fn from_q_string_q_font( text: impl CastInto<Ref<QString>>, font: impl CastInto<Ref<QFont>> ) -> CppBox<QTextLayout>

Constructs a text layout to lay out the given text with the specified font.

Calls C++ function: [constructor] void QTextLayout::QTextLayout(const QString& text, const QFont& font).

C++ documentation:

Constructs a text layout to lay out the given text with the specified font.

All the metric and layout calculations will be done in terms of the paint device, paintdevice. If paintdevice is 0 the calculations will be done in screen metrics.

source

pub unsafe fn next_cursor_position_2a( &self, old_pos: c_int, mode: CursorMode ) -> c_int

Returns the next valid cursor position after oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

Calls C++ function: int QTextLayout::nextCursorPosition(int oldPos, QTextLayout::CursorMode mode = …) const.

C++ documentation:

Returns the next valid cursor position after oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

See also isValidCursorPosition() and previousCursorPosition().

source

pub unsafe fn next_cursor_position_1a(&self, old_pos: c_int) -> c_int

Returns the next valid cursor position after oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

Calls C++ function: int QTextLayout::nextCursorPosition(int oldPos) const.

C++ documentation:

Returns the next valid cursor position after oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

See also isValidCursorPosition() and previousCursorPosition().

source

pub unsafe fn position(&self) -> CppBox<QPointF>

The global position of the layout. This is independent of the bounding rectangle and of the layout process.

Calls C++ function: QPointF QTextLayout::position() const.

C++ documentation:

The global position of the layout. This is independent of the bounding rectangle and of the layout process.

This function was introduced in Qt 4.2.

See also setPosition().

source

pub unsafe fn preedit_area_position(&self) -> c_int

Returns the position of the area in the text layout that will be processed before editing occurs.

Calls C++ function: int QTextLayout::preeditAreaPosition() const.

C++ documentation:

Returns the position of the area in the text layout that will be processed before editing occurs.

See also preeditAreaText().

source

pub unsafe fn preedit_area_text(&self) -> CppBox<QString>

Returns the text that is inserted in the layout before editing occurs.

Calls C++ function: QString QTextLayout::preeditAreaText() const.

C++ documentation:

Returns the text that is inserted in the layout before editing occurs.

See also preeditAreaPosition().

source

pub unsafe fn previous_cursor_position_2a( &self, old_pos: c_int, mode: CursorMode ) -> c_int

Returns the first valid cursor position before oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

Calls C++ function: int QTextLayout::previousCursorPosition(int oldPos, QTextLayout::CursorMode mode = …) const.

C++ documentation:

Returns the first valid cursor position before oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

See also isValidCursorPosition() and nextCursorPosition().

source

pub unsafe fn previous_cursor_position_1a(&self, old_pos: c_int) -> c_int

Returns the first valid cursor position before oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

Calls C++ function: int QTextLayout::previousCursorPosition(int oldPos) const.

C++ documentation:

Returns the first valid cursor position before oldPos that respects the given cursor mode. Returns value of oldPos, if oldPos is not a valid cursor position.

See also isValidCursorPosition() and nextCursorPosition().

source

pub unsafe fn right_cursor_position(&self, old_pos: c_int) -> c_int

Returns the cursor position to the right of oldPos, next to it. It's dependent on the visual position of characters, after bi-directional reordering.

Calls C++ function: int QTextLayout::rightCursorPosition(int oldPos) const.

C++ documentation:

Returns the cursor position to the right of oldPos, next to it. It’s dependent on the visual position of characters, after bi-directional reordering.

See also leftCursorPosition() and nextCursorPosition().

source

pub unsafe fn set_additional_formats( &self, overrides: impl CastInto<Ref<QListOfFormatRange>> )

See also additionalFormats().

Calls C++ function: void QTextLayout::setAdditionalFormats(const QList<QTextLayout::FormatRange>& overrides).

C++ documentation:

See also additionalFormats().

source

pub unsafe fn set_cache_enabled(&self, enable: bool)

Enables caching of the complete layout information if enable is true; otherwise disables layout caching. Usually QTextLayout throws most of the layouting information away after a call to endLayout() to reduce memory consumption. If you however want to draw the laid out text directly afterwards enabling caching might speed up drawing significantly.

Calls C++ function: void QTextLayout::setCacheEnabled(bool enable).

C++ documentation:

Enables caching of the complete layout information if enable is true; otherwise disables layout caching. Usually QTextLayout throws most of the layouting information away after a call to endLayout() to reduce memory consumption. If you however want to draw the laid out text directly afterwards enabling caching might speed up drawing significantly.

See also cacheEnabled().

source

pub unsafe fn set_cursor_move_style(&self, style: CursorMoveStyle)

Sets the visual cursor movement style to the given style. If the QTextLayout is backed by a document, you can ignore this and use the option in QTextDocument, this option is for widgets like QLineEdit or custom widgets without a QTextDocument. Default value is Qt::LogicalMoveStyle.

Calls C++ function: void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style).

C++ documentation:

Sets the visual cursor movement style to the given style. If the QTextLayout is backed by a document, you can ignore this and use the option in QTextDocument, this option is for widgets like QLineEdit or custom widgets without a QTextDocument. Default value is Qt::LogicalMoveStyle.

See also cursorMoveStyle().

source

pub unsafe fn set_flags(&self, flags: c_int)

Calls C++ function: void QTextLayout::setFlags(int flags).

source

pub unsafe fn set_font(&self, f: impl CastInto<Ref<QFont>>)

Sets the layout's font to the given font. The layout is invalidated and must be laid out again.

Calls C++ function: void QTextLayout::setFont(const QFont& f).

C++ documentation:

Sets the layout’s font to the given font. The layout is invalidated and must be laid out again.

See also font().

source

pub unsafe fn set_formats( &self, overrides: impl CastInto<Ref<QVectorOfFormatRange>> )

Sets the additional formats supported by the text layout to formats. The formats are applied with preedit area text in place.

Calls C++ function: void QTextLayout::setFormats(const QVector<QTextLayout::FormatRange>& overrides).

C++ documentation:

Sets the additional formats supported by the text layout to formats. The formats are applied with preedit area text in place.

This function was introduced in Qt 5.6.

See also formats() and clearFormats().

source

pub unsafe fn set_position(&self, p: impl CastInto<Ref<QPointF>>)

Moves the text layout to point p.

Calls C++ function: void QTextLayout::setPosition(const QPointF& p).

C++ documentation:

Moves the text layout to point p.

See also position().

source

pub unsafe fn set_preedit_area( &self, position: c_int, text: impl CastInto<Ref<QString>> )

Sets the position and text of the area in the layout that is processed before editing occurs. The layout is invalidated and must be laid out again.

Calls C++ function: void QTextLayout::setPreeditArea(int position, const QString& text).

C++ documentation:

Sets the position and text of the area in the layout that is processed before editing occurs. The layout is invalidated and must be laid out again.

See also preeditAreaPosition() and preeditAreaText().

source

pub unsafe fn set_raw_font(&self, raw_font: impl CastInto<Ref<QRawFont>>)

Calls C++ function: void QTextLayout::setRawFont(const QRawFont& rawFont).

source

pub unsafe fn set_text(&self, string: impl CastInto<Ref<QString>>)

Sets the layout's text to the given string. The layout is invalidated and must be laid out again.

Calls C++ function: void QTextLayout::setText(const QString& string).

C++ documentation:

Sets the layout’s text to the given string. The layout is invalidated and must be laid out again.

Notice that when using this QTextLayout as part of a QTextDocument this method will have no effect.

See also text().

source

pub unsafe fn set_text_option(&self, option: impl CastInto<Ref<QTextOption>>)

Sets the text option structure that controls the layout process to the given option.

Calls C++ function: void QTextLayout::setTextOption(const QTextOption& option).

C++ documentation:

Sets the text option structure that controls the layout process to the given option.

See also textOption().

source

pub unsafe fn text(&self) -> CppBox<QString>

Returns the layout's text.

Calls C++ function: QString QTextLayout::text() const.

C++ documentation:

Returns the layout’s text.

See also setText().

source

pub unsafe fn text_option(&self) -> Ref<QTextOption>

Returns the current text option used to control the layout process.

Calls C++ function: const QTextOption& QTextLayout::textOption() const.

C++ documentation:

Returns the current text option used to control the layout process.

See also setTextOption().

Trait Implementations§

source§

impl CppDeletable for QTextLayout

source§

unsafe fn delete(&self)

Destructs the layout.

Calls C++ function: [destructor] void QTextLayout::~QTextLayout().

C++ documentation:

Destructs the layout.

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, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. 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> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

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

§

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>,

§

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.