Kimundi / owning-ref-rs

A library for creating references that carry their owner with them.
MIT License
361 stars 50 forks source link

Exemple of storing OwningRef on a struct #62

Open zbraniecki opened 4 years ago

zbraniecki commented 4 years ago

Could you add an example and/or doc on how to use owning-ref to store a struct as a field on a struct next to the owned value.

A use case I have is a struct storing a String and "view" into that string (AST): https://github.com/projectfluent/fluent-rs/blob/master/fluent-bundle/src/resource.rs#L5-L14

I looked around the docs of owning-ref but can't find an example of how is that intended to work in owning-ref API.