Endpoint

Structin logfastly 0.13.1View source
pub struct Endpoint { /* private fields */ }

A Fastly logging endpoint.

Most applications should use the high-level interface provided by log-fastly rather than writing to this interface directly.

To write to this endpoint, use the std::io::Write interface. For example:

use std::io::Write;
let mut endpoint = Endpoint::from_name("my_endpoint");
writeln!(endpoint, "Hello from the edge!")?;

Methods

from_name

View source
fn from_name(name: &str) -> Self

Get an Endpoint by name.

Panics

If the endpoint name is not valid, this function will panic.

Parameters

name: &str

Returns

Self

from_u32

View source
unsafe fn from_u32(handle: u32, name: String) -> Self

Make a handle from its underlying representation.

This should only be used when calling the raw ABI directly, and care should be taken not to reuse or alias handle values.

Parameters

handle: u32
name: String

Returns

Self
fn name(&self) -> &str

Get the name of an Endpoint.

Parameters

self: &Self

Returns

&str

try_from_name

View source
fn try_from_name(name: &str) -> Result<Self, LogError>

Try to get an Endpoint by name.

Currently, the conditions on an endpoint name are:

  • It must not be empty

  • It must not contain newlines (\n) or colons (:)

  • It must not be stdout or stderr, which are reserved for debugging.

Parameters

name: &str

Returns

Trait implementations

impl Clone for Endpoint

fn clone(&self) -> Self

Parameters

self: &Self

Returns

Self

impl Debug for Endpoint

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Parameters

self: &Self
fmt: &mut std::fmt::Formatter

Returns

std::fmt::Result

impl Hash for Endpoint

fn hash<__H: Hasher>(&self, state: &mut __H)

Parameters

self: &Self
state: &mut __H

impl PartialEq for Endpoint

fn eq(&self, other: &Self) -> bool

Parameters

self: &Self
other: &Self

Returns

bool

impl TryFrom<&str> for Endpoint

try_from

View source
fn try_from(name: &str) -> Result<Self, Self::Error>

Parameters

name: &str

Returns

Result<Self, Self::Error>

impl TryFrom<String> for Endpoint

try_from

View source
fn try_from(name: String) -> Result<Self, Self::Error>

Parameters

name: String

Returns

Result<Self, Self::Error>

impl Write for Endpoint

fn flush(&mut self) -> Result<()>

Parameters

self: &mut Self

Returns

std::io::Result<()>
fn write(&mut self, buf: &[u8]) -> Result<usize>

Parameters

self: &mut Self
buf: &[u8]

Returns

std::io::Result<usize>

Auto trait implementations

Blanket implementations