# Trait unicode_width::UnicodeWidthChar [−] [src]

    pub trait UnicodeWidthChar {
        fn width(self) -> Option<usize>;
        fn width_cjk(self) -> Option<usize>;
    }

Methods for determining displayed width of Unicode characters.

## Required Methods

### `fn width(self) -> Option<usize>`

Returns the character's displayed width in columns, or `None` if the character is a control character other than `'\x00'`.

This function treats characters in the Ambiguous category according to Unicode Standard Annex #11 as 1 column wide. This is consistent with the recommendations for non-CJK contexts, or when the context cannot be reliably determined.

### `fn width_cjk(self) -> Option<usize>`

Returns the character's displayed width in columns, or `None` if the character is a control character other than `'\x00'`.

This function treats characters in the Ambiguous category according to Unicode Standard Annex #11 as 2 columns wide. This is consistent with the recommendations for CJK contexts.

## Implementors

- `impl UnicodeWidthChar for char`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)