# json::short::Short - Rust
API documentation for the Rust `Short` struct in crate `json`.
Keywords: rust, rustlang, rust-lang, Short

# [−] [src] Struct json::short::Short

    pub struct Short { /* fields omitted */ }

## Implementations

### `impl Short` [src]

A `Short` is a small string, up to `MAX_LEN` bytes, that can be managed without the expensive heap allocation performed for the regular `String` type.

#### `pub unsafe fn from_slice(slice: &str) -> Self` [src]

Creates a `Short` from a `&str` slice. This method can cause buffer overflow if the length of the slice is larger than `MAX_LEN`, which is why it is marked as `unsafe`.

Typically you should avoid creating your own `Short`s, instead create a `JsonValue` (either using `"foo".into()` or `JsonValue::from("foo")`) out of a slice. This will automatically decide on `String` or `Short` for you.

#### `pub fn as_str(&self) -> &str` [src]

Cheaply obtain a `&str` slice out of the `Short`.

## Trait Implementations

### `impl Clone for Short` [src]

#### `fn clone(&self) -> Short` [src]

Returns a copy of the value. Read more

#### `pub fn clone_from(&mut self, source: &Self)`1.0.0 [src]

Performs copy-assignment from `source`. Read more

### `impl Copy for Short` [src]

### `impl Debug for Short` [src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl Deref for Short` [src]

Implements `Deref` for `Short` means that, just like `String`, you can pass `&Short` to functions that expect `&str` and have the conversion happen automagically. On top of that, all methods present on `&str` can be called on an instance of `Short`.

#### `type Target = str`

The resulting type after dereferencing.

#### `fn deref(&self) -> &str` [src]

Dereferences the value.

### `impl Display for Short` [src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl From<Short> for String` [src]

#### `fn from(short: Short) -> String` [src]

Performs the conversion.

### `impl PartialEq<Short> for Short` [src]

#### `fn eq(&self, other: &Short) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl PartialEq<Short> for str` [src]

#### `fn eq(&self, other: &Short) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl PartialEq<Short> for String` [src]

#### `fn eq(&self, other: &Short) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl PartialEq<String> for Short` [src]

#### `fn eq(&self, other: &String) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

### `impl PartialEq<str> for Short` [src]

#### `fn eq(&self, other: &str) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]pub fn ne(&self, other: &Rhs) -> bool` 1.0.0 [src]

This method tests for `!=`.

## Auto Trait Implementations

### `impl RefUnwindSafe for Short` [src]

### `impl Send for Short` [src]

### `impl Sync for Short` [src]

### `impl Unpin for Short` [src]

### `impl UnwindSafe for Short` [src]

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `pub fn to_owned(&self) -> T` [src]

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

#### `pub fn clone_into(&self, target: &mut T)` [src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T> ToString for T where
T: Display + ?Sized,` [src]

#### `pub default fn to_string(&self) -> String` [src]

Converts the given value to a `String`. Read more

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.