From 527a518156525a2ea4d3444edf5cfd4e5cbe3bc4 Mon Sep 17 00:00:00 2001 From: Mandar Chitre Date: Thu, 5 Oct 2023 23:26:56 +0800 Subject: [PATCH] doc: update README.md with new API --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8db7daa..76ad2e5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The usage of the package is best illustrated with a simple example: using ProtocolDataUnits # define PDU format -Base.@kwdef struct EthernetFrame <: PDU +Base.@kwdef struct EthernetFrame <: AbstractPDU dstaddr::NTuple{6,UInt8} # fixed length srcaddr::NTuple{6,UInt8} # fixed length ethtype::UInt16 # fixed length @@ -35,10 +35,10 @@ frame = EthernetFrame( ) # convert to a byte array -bytes = Vector{UInt8}(frame) +bytes = PDU.encode(frame) # convert back to Ethernet frame -decoded = EthernetFrame(bytes) +decoded = PDU.decode(bytes, EthernetFrame) # check that they are the same @assert frame == decoded