func (r Relation) ImplementedBy(ch Charm) bool {
	if r.IsImplicit() {
		return true
	}
	var m map[string]Relation
	switch r.Role {
	case RoleProvider:
		m = ch.Meta().Provides
	case RoleRequirer:
		m = ch.Meta().Requires
	case RolePeer:
		m = ch.Meta().Peers
	default:
		panic(errors.Errorf("unknown relation role %q", r.Role))
	}
	rel, found := m[r.Name]
	if !found {
		return false
	}
	if rel.Interface == r.Interface {
		switch r.Scope {
		case ScopeGlobal:
			return rel.Scope != ScopeContainer
		case ScopeContainer:
			return true
		default:
			panic(errors.Errorf("unknown relation scope %q", r.Scope))
		}
	}
	return false
}
// ImplementedBy returns whether the relation is implemented by the supplied charm.
ImplementedBy returns whether the relation is implemented by the supplied charm.
// ImplementedBy returns whether the relation is implemented by the supplied charm .
func (r Relation) ImplementedBy(ch Charm) bool {
	if r.IsImplicit() {
		return true
	}
	var m map[string]Relation
	switch r.Role {
	case RoleProvider:
		m = ch.Meta().Provides
	case RoleRequirer:
		m = ch.Meta().Requires
	case RolePeer:
		m = ch.Meta().Peers
	default:
		panic(errors.Errorf("unknown relation role %q", r.Role))
	}
	rel, found := m[r.Name]
	if !found {
		return false
	}
	if rel.Interface == r.Interface {
		switch r.Scope {
		case ScopeGlobal:
			return rel.Scope != ScopeContainer
		case ScopeContainer:
			return true
		default:
			panic(errors.Errorf("unknown relation scope %q", r.Scope))
		}
	}
	return false
}
func ( r Relation ) ImplementedBy ( ch Charm ) bool { if r . IsImplicit ( ) { return true } var m map [ string ] Relation switch r . Role { case RoleProvider : m = ch . Meta ( ) . Provides case RoleRequirer : m = ch . Meta ( ) . Requires case RolePeer : m = ch . Meta ( ) . Peers default : panic ( errors . Errorf ( " " , r . Role ) ) } rel , found := m [ r . Name ] if ! found { return false } if rel . Interface == r . Interface { switch r . Scope { case ScopeGlobal : return rel . Scope != ScopeContainer case ScopeContainer : return true default : panic ( errors . Errorf ( " " , r . Scope ) ) } } return false }
ImplementedBy returns whether the relation is implemented by the supplied charm.
ImplementedBy returns whether the relation is implemented by the supplied charm .