adapt as lib