Code Explainers

Code explainers tagged #structs

go
package config
 
import "time"
 

The functional options pattern in Go

functional-options closures immutability
Intermediate 7 steps
ruby
require "forwardable"
 
class ShoppingCart
  extend Forwardable

Delegation in Ruby with Forwardable

delegation composition enumerable
Intermediate 9 steps
rust
use chrono::{DateTime, Duration, FixedOffset, Utc};
 
#[derive(Debug)]
pub struct EventWindow {

Parsing and measuring time windows in Rust

datetime error-handling pattern-matching
Intermediate 7 steps
ruby
module LogParser
  class AccessLogStreamer
    SEVERITY_PATTERN = /\b(ERROR|WARN|FATAL)\b/
 

Streaming log lines with a Ruby enumerator

enumerators lazy-iteration regex-matching
Intermediate 6 steps
go
package geometry
 
import "fmt"
 

Implementing fmt.Stringer in Go

interfaces stringer composition
Beginner 5 steps