This patch adds support for directional links in libimagentrylink.
A directional link is added to the same header as the "internal" links,
which are unidirectional.
The "outgoing" link is added in "links.to", the "incoming" links are
added to "links.from".
This way we can always traverse all linkage. The `Linkable::links()`
method is changed to always return _all_ link.
The `Link` type was extended for notions of "to" and "from" links.
Also adds testing.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This patch removes the annotateable linking feature from libimagentrylink.
It was not used anyways.
Also, this patch rewrites the complete linking code to use the
toml-query "typed" feature rather than constructing everything by
itself.
This removes a lot of unmaintainable boilerplate code.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
With this patch, the libimagentrylink library interface gets renamed.
The trait gets renamed to the more descriptive name "Linkable", the
functions get renamed to not contain any notion of "internal" anymore.
This patch also adapts the whole source tree for the new libimagentrylink
interface, also renaming variables to not contain "_internal_" anymore.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This function needs to be removed because of the following problem:
When linking from one entry to another, and then removing the link in
the first entry with ::set_internal_links(vec![]), we end up with a
dangling link in the second entry, because the ::set_internal_links()
function does not take care of removing the links in the "other"
entries.
Actually, it is not even able to do so, because it would need to
`Store::get()` those entries, but it does not have access to the store.
Adding a `store` parameter to the function would be possible, but only
increase its complexity unnecessarily. This is why I opt for removing
this function (which is btw not used once in the whole imag codebase).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
With this patch we move the codebase to Rust-2018.
The diff was generated by executing
cargo fix --all --all-features --edition
on the codebase.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Because the code was so complex before, we had to create an object and
then cast that object into a `StoreId` rather than just creating a
`StoreId` object right away.
With this patch, we're using the code-generation approach to generate a
function that creates a `StoreId` object based on the name of the
current module. That's way easier and error handling was also improved
by the switch to the new implementation.
The patch also includes a rewrite of all usages of ModuleEntryPath and
changes them to `module_path::new_id()` calls.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
The beta compiler reports duplicated input:
error: the item `IntoValues` is imported redundantly
--> lib/entry/libimagentrylink/src/internal.rs:398:13
|
36 | use self::iter::IntoValues;
| ---------------------- the item `IntoValues` is already imported here
...
398 | use internal::iter::IntoValues;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
so we fix this here.
Other imports were fixed as well.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
With this change applied, libimagstore does not export backend
representing types anymore.
This change is necessar because when we want to switch the `StoreId`
implementation from "complex and stateful" to "Stateless and Cow<'_,
&str>", we need to be able to have a type which represents a "`StoreId`
plus the path of the Store itself".
This "the path of the Store itself" is passed around as reference, to
minimize runtime impact.
Because such a type should not be exported by the libimagstore crate, we
make it `pub(crate)` internally. But because the backend APIs also have
to use this type, we would export the (private) type in the APIs of the
backend.
Because of that we make the backend API also non-visible to crate users,
which also decreases the surface of the libimagstore API itself.
Besides:
Remove function `Link::with_base()` which is not needed anymore (was
used in tests only).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
...to report newly created entries, so that we can re-use these new
entries in the library-using code (for example for ID reporting).
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>