Compares two msgs, ignores sub but checks all other public fields.
(msg *Msg)
| 809 | |
| 810 | // Compares two msgs, ignores sub but checks all other public fields. |
| 811 | func (m *Msg) Equal(msg *Msg) bool { |
| 812 | if m == msg { |
| 813 | return true |
| 814 | } |
| 815 | if m == nil || msg == nil { |
| 816 | return false |
| 817 | } |
| 818 | if m.Subject != msg.Subject || m.Reply != msg.Reply { |
| 819 | return false |
| 820 | } |
| 821 | if !bytes.Equal(m.Data, msg.Data) { |
| 822 | return false |
| 823 | } |
| 824 | if len(m.Header) != len(msg.Header) { |
| 825 | return false |
| 826 | } |
| 827 | for k, v := range m.Header { |
| 828 | val, ok := msg.Header[k] |
| 829 | if !ok || len(v) != len(val) { |
| 830 | return false |
| 831 | } |
| 832 | for i, hdr := range v { |
| 833 | if hdr != val[i] { |
| 834 | return false |
| 835 | } |
| 836 | } |
| 837 | } |
| 838 | return true |
| 839 | } |
| 840 | |
| 841 | // Size returns a message size in bytes. |
| 842 | func (m *Msg) Size() int { |
no outgoing calls