Skip to main content

JwtPick

Struct JwtPick 

Source
pub struct JwtPick<'a> {
    pub part: &'static str,
    pub index: usize,
    pub node: &'a Node,
    pub path: String,
    pub json: Option<([usize; 2], &'a str)>,
}
Expand description

A JWT part picked by select_jwt, optionally narrowed to one JSON value inside the header or payload.

Fields§

§part: &'static str

header, payload, signature (JWS) or header, encrypted_key, iv, ciphertext, tag (JWE).

§index: usize

The part’s position in the token.

§node: &'a Node

The part’s base64url layer node.

§path: String

The JSON path within the part (empty when the whole part is picked).

§json: Option<([usize; 2], &'a str)>

The selected value’s byte range in the part’s decoded text, and that text (validated JSON), when path is non-empty.

Implementations§

Source§

impl JwtPick<'_>

Source

pub fn to_json(&self) -> String

Serialize as {"part":..,"index":..,"node":Node} for a whole part, or {"part":..,"index":..,"path":..,"range":[s,e],"value":<JSON>}.

Source

pub fn to_tree(&self) -> String

Render as an outline: the part’s node tree, or payload.sub = "…".

Source

pub fn payload(&self) -> Vec<u8> ⓘ

The selection’s bytes for --format raw: a JSON string’s unescaped text, any other JSON value verbatim, or a whole part’s decoded bytes.

Trait Implementations§

Source§

impl<'a> Debug for JwtPick<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for JwtPick<'a>

§

impl<'a> Freeze for JwtPick<'a>

§

impl<'a> Move for JwtPick<'a>

§

impl<'a> RefUnwindSafe for JwtPick<'a>

§

impl<'a> Send for JwtPick<'a>

§

impl<'a> Sync for JwtPick<'a>

§

impl<'a> Unpin for JwtPick<'a>

§

impl<'a> UnsafeUnpin for JwtPick<'a>

§

impl<'a> UnwindSafe for JwtPick<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.