cookie_rs::cookie

Module parse

Source
Expand description

Parsing utilities for Cookie.

This module provides functionality for parsing Cookie instances from strings. It supports both strict and lenient parsing modes and handles attributes such as Domain, Path, Max-Age, Secure, and more.

§Features

  • Flexible parsing with parse and parse_strict methods.
  • Detailed error handling using ParseError and ParseSameSiteError.
  • Support for common cookie attributes.

§Example

use cookie_rs::prelude::*;

let cookie = Cookie::parse("session=abc123; Path=/; Secure").unwrap();
assert_eq!(cookie.name(), "session");
assert_eq!(cookie.value(), "abc123");
assert_eq!(cookie.path(), Some("/"));
assert_eq!(cookie.secure(), Some(true));

Re-exports§

Modules§