public MsgBuilder(IMessage message)
        {
            var headerSpan = message.Header.AsSpan();

            if (headerSpan.Length > 0)
            {
                Header = new MsgPart(headerSpan.ToArray());
            }
            var bodySpan = message.AsSpan();

            if (bodySpan.Length > 0)
            {
                Body = new MsgPart(bodySpan.ToArray());
            }
        }
        /// <summary>
        /// Copy contents of nng message from unmanaged to managed memory.
        /// </summary>
        /// <param name="message"></param>
        public Msg(IMessage message)
        {
            var headerSpan = message.Header.AsSpan();

            if (headerSpan.Length > 0)
            {
                header = headerSpan.ToArray();
            }
            var bodySpan = message.AsSpan();

            if (bodySpan.Length > 0)
            {
                body = bodySpan.ToArray();
            }
        }
Exemple #3
0
 public static bool Equals(IMessage lhs, IMessage rhs)
 {
     return(BytesEqual(lhs.AsSpan(), rhs.AsSpan()) && BytesEqual(lhs.Header.AsSpan(), rhs.Header.AsSpan()));
 }