I'm curious if any programming language has a feature allowing multiple member functions in a class --- or some analogous construct in non-OO contexts --- to be grouped together as if they were implementing an interface. The point is not, however, that the class itself implements multiple interfaces, but that it somehow "composes" interfaces in parallel to composition via data members. In other words, it would be helpful to merge the design principles of interfaces and of composition (as an alternative to inheritance).
To be more specific, a baseline example of this sort of thing would be accessors; it's almost ubiquitous to "expose" data "x" via methods like get_x() and set_x(...). It's as if get_x and set_x together satisfy the contract of an "interface" vis-a-vis x, whose form derives from x's status as an ordinary data member. But suppose alongside x we have some "v" which is a vector/array/list and instead of "set_v(...)" we want to support modifying v in place. If v is a collection of books, say, we might have "add_book(...)", "first_book()", "last_book()", "remove_book()", "number_of_books()", and so on.
It would be cool to have a mechanism where we can specify not only that some value is a data member of a class, but that the class supports manipulation of that value through a collection of class members whose details reflect how the data member is used --- something like an interface expressed at the level of a single data member, so that a class could have many such interfaces just as it might have many data members. Perhaps this could be called a "composition interface" or "member interface" and could be declared with some sort of wildcard pattern for function names.
Suppose I want to define a "member interface" for a list-like type. If this were a class interface I could just stipulate that any conformant class needs an "append()" method, a "size()", and so forth, but here I want to declare methods specific to a given data member, so perhaps a wildcard like a % sign: a typical list-like interface could have "add_%(...)" (e.g., add_book(...)), "number_of_%s" (number_of_books(...)) etc.
I don't know of any languages which support constructs along these lines. Am I missing something?
I've searched for terms like "member interface" and discussions about interfaces (or traits, etc.) and/or composition-vs.-inheritance in the context of different languages. There are subtle (sometimes not-so-subtle) differences between Java, Go, Rust, etc., but nobody seems to have a system analogous to what I've described.