marker: add a Segments struct and move code to its impl

Move code from plain functions to methods of the struct.
Also implement the From trait to convert from the path
builder and Deref trait to automatically get the inner
vector.
7 jobs from marker in 25 minutes and 25 seconds (queued for 2 seconds)
latest
Status Job ID Name Coverage
  Test
passed #169581
fedora test

00:06:40

 
  Lint
manual #169583
allowed to fail manual
clippy
passed #169582
rustfmt

00:00:33

passed #169584
tarball

00:10:10

 
  Cross Distro
passed #169587
debian_i386:testing

00:08:32

passed #169586
debian:testing

00:07:41

passed #169585
fedora:rawhide

00:08:13