usbc-cable-caps 0.1.0

Decode what a USB-C cable can actually carry — power, data rate and video — from its e-marker class rather than its label.
Documentation
  • Coverage
  • 89.47%
    17 out of 19 items documented0 out of 9 items with examples
  • Size
  • Source code size: 10.7 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 123.9 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • taysirco/usbc-cable-caps
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • althaqelco

usbc-cable-caps

Every USB-C plug is the same shape. Almost nothing else about USB-C cables is.

[dependencies]
usbc-cable-caps = "0.1"
use usbc_cable_caps::*;

let bundled = typical_bundled();
bundled.max_watts_at(20.0);            // 60 W — not the 100 W on the charger
bundled.data.carries_video();          // false

let marked = Cable { emarker: true, declared_amps: 5.0, ..typical_bundled() };
marked.can_deliver(100.0, 20.0);       // true

Two facts decide everything

Above 3 A a cable needs an e-marker chip. The chip declares the rating to the source. Without it the source must assume 3 A, and it will — no matter how thick the copper inside actually is. This is a protocol limit, not a thermal one, and it is why a well-built unmarked cable still caps a 100 W laptop charger at 60 W.

Power and data are independent axes. A cable can carry 240 W and 480 Mbps. Another carries 60 W and 40 Gbps. The connector reveals neither. The most common disappointment follows directly: a cable that charges a laptop flawlessly and shows nothing at all on an external monitor, because USB 2.0 wiring has no high-speed pairs for the DisplayPort alternate mode to use.

Why long fast cables cost what they do

Signal loss rises with both length and frequency, so the faster the class the shorter a passive cable can be — roughly 4 m at USB 2.0 speeds, under a metre at 40 Gbps. Longer fast cables exist, but they contain active signal conditioning. passive_length_is_plausible encodes that relationship, and it doubles as a sanity check on listings: a cheap passive 3 m cable advertising 40 Gbps is claiming something the physics does not allow.

On the naming

USB 3.0 became USB 3.1 Gen 1, then USB 3.2 Gen 1, all describing the same 5 Gbps. This crate uses Gen1, Gen2, Gen2x2 and Usb4 because the throughput is the only stable thing about the naming. Treat any speed claim that cites a version number rather than a bitrate as unresolved.

Specifications for individual cables — gauge, e-marker rating and data class — are listed on CairoVolt's cable pages.

Licence

MIT