From 5ce4b22e40322385fd290951762c69fad2128552 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 23 Nov 2021 14:23:49 +0300 Subject: [PATCH] [#356] refs: Implement `Unmarshal` method on `SubnetID` Signed-off-by: Leonard Lyubich --- refs/marshal.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/refs/marshal.go b/refs/marshal.go index 11feb22..148ad58 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -348,3 +348,11 @@ func (s *SubnetID) StableSize() (size int) { return } + +// Unmarshal unmarshals SubnetID from NeoFS API V2 binary format (see StableMarshal). +// Must not be called on nil. +// +// Note: empty data corresponds to zero ID value or nil pointer to it. +func (s *SubnetID) Unmarshal(data []byte) error { + return message.Unmarshal(s, data, new(refs.SubnetID)) +}