github.com/DiversionCompany/notify@v0.9.9/watchpoint_other.go (about)

     1  // Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
     2  // Use of this source code is governed by the MIT license that can be
     3  // found in the LICENSE file.
     4  
     5  //go:build !windows
     6  // +build !windows
     7  
     8  package notify
     9  
    10  // eventmask uses ei to create a new event which contains internal flags used by
    11  // notify package logic.
    12  func eventmask(ei EventInfo, extra Event) Event {
    13  	return ei.Event() | extra
    14  }
    15  
    16  // matches reports a match only when:
    17  //
    18  //   - for user events, when event is present in the given set
    19  //   - for internal events, when additionally both event and set have omit bit set
    20  //
    21  // Internal events must not be sent to user channels and vice versa.
    22  func matches(set, event Event) bool {
    23  	return (set&omit)^(event&omit) == 0 && set&event == event
    24  }