# Struct openssl::ssl::SslSession [−] [src]

    pub struct SslSession(_);

An encoded SSL session.

These can be cached to share sessions across connections.

## Implementations

### `impl SslSession` [src]

#### `pub fn from_der(der: &[u8]) -> Result<SslSession, ErrorStack>` [src]

Deserializes a DER-encoded session structure.

This corresponds to `d2i_SSL_SESSION`.

## Methods from Deref<Target = SslSessionRef>

#### `pub fn id(&self) -> &[u8]ⓘ

### Notable traits for &'_ [u8]

`impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]`
` [src]

Returns the SSL session ID.

This corresponds to `SSL_SESSION_get_id`.

#### `pub fn master_key_len(&self) -> usize` [src]

Returns the length of the master key.

This corresponds to `SSL_SESSION_get_master_key`.

#### `pub fn master_key(&self, buf: &mut [u8]) -> usize` [src]

Copies the master key into the provided buffer.

Returns the number of bytes written, or the size of the master key if the buffer is empty.

This corresponds to `SSL_SESSION_get_master_key`.

#### `pub fn max_early_data(&self) -> u32` [src]

Gets the maximum amount of early data that can be sent on this session.

Requires OpenSSL 1.1.1 or newer.

This corresponds to `SSL_SESSION_get_max_early_data`.

#### `pub fn time(&self) -> i64` [src]

Returns the time at which the session was established, in seconds since the Unix epoch.

This corresponds to `SSL_SESSION_get_time`.

#### `pub fn timeout(&self) -> i64` [src]

Returns the sessions timeout, in seconds.

A session older than this time should not be used for session resumption.

This corresponds to `SSL_SESSION_get_timeout`.

#### `pub fn protocol_version(&self) -> SslVersion` [src]

Returns the session’s TLS protocol version.

Requires OpenSSL 1.1.0 or newer.

This corresponds to `SSL_SESSION_get_protocol_version`.

#### `pub fn to_der(&self) -> Result<Vec<u8>, ErrorStack>` [src]

Serializes the session into a DER-encoded structure.

This corresponds to `i2d_SSL_SESSION`.

## Trait Implementations

### `impl AsRef<SslSessionRef> for SslSession` [src]

#### `fn as_ref(&self) -> &SslSessionRef` [src]

Performs the conversion.

### `impl Borrow<SslSessionRef> for SslSession` [src]

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

Immutably borrows from an owned value. Read more

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

#### `fn clone(&self) -> SslSession` [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 Deref for SslSession` [src]

#### `type Target = SslSessionRef`

The resulting type after dereferencing.

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

Dereferences the value.

### `impl DerefMut for SslSession` [src]

#### `fn deref_mut(&mut self) -> &mut SslSessionRef` [src]

Mutably dereferences the value.

### `impl Drop for SslSession` [src]

#### `fn drop(&mut self)` [src]

Executes the destructor for this type. Read more

### `impl ForeignType for SslSession` [src]

#### `type CType = SSL_SESSION`

The raw C type.

#### `type Ref = SslSessionRef`

The type representing a reference to this type.

#### `unsafe fn from_ptr(ptr: *mut SSL_SESSION) -> SslSession` [src]

Constructs an instance of this type from its raw type.

#### `fn as_ptr(&self) -> *mut SSL_SESSION` [src]

Returns a raw pointer to the wrapped value.

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

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

## Auto Trait Implementations

### `impl RefUnwindSafe for SslSession`

### `impl Unpin for SslSession`

### `impl UnwindSafe for SslSession`

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