// Generated by Lisette bindgen
// Source: encoding/pem (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

import "go:io"

/// Decode will find the next PEM formatted block (certificate, private key
/// etc) in the input. It returns that block and the remainder of the input. If
/// no PEM data is found, p is nil and the whole of the input is returned in
/// rest. Blocks must start at the beginning of a line and end at the end of a line.
pub fn Decode(data: Slice<byte>) -> (Ref<Block>, Slice<byte>)

/// Encode writes the PEM encoding of b to out.
pub fn Encode(out: io.Writer, b: Ref<Block>) -> Result<(), error>

/// EncodeToMemory returns the PEM encoding of b.
/// 
/// If b has invalid headers and cannot be encoded,
/// EncodeToMemory returns nil. If it is important to
/// report details about this error case, use [Encode] instead.
pub fn EncodeToMemory(b: Ref<Block>) -> Slice<byte>

/// A Block represents a PEM encoded structure.
/// 
/// The encoded form is:
/// 
/// 	-----BEGIN Type-----
/// 	Headers
/// 	base64-encoded Bytes
/// 	-----END Type-----
/// 
/// where [Block.Headers] is a possibly empty sequence of Key: Value lines.
pub struct Block {
  pub Type: string,
  pub Headers: Map<string, string>,
  pub Bytes: Slice<byte>,
}
